Skip to content

Commit 01659c7

Browse files
committed
docs: expand README example, tidy docs
- README: example and output cover every visible parser case (verified) - CHANGELOG: simplify preamble - CONTRIBUTING: rewrite (code of conduct, contribution types) - LICENSE: extend copyright year
1 parent 2a2b1b7 commit 01659c7

4 files changed

Lines changed: 86 additions & 105 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
# Change Log
22

3-
All notable changes to this project will be documented in this file.
4-
5-
The format is based on [Keep a Changelog](http://keepachangelog.com/)
6-
and this project adheres to [Semantic Versioning](http://semver.org/).
3+
All notable changes to this project will be documented in this file. This project adheres to [Semantic Versioning](http://semver.org/).
74

85
## [3.0.1](https://github.com/ungoldman/changelog-parser/compare/v3.0.0...v3.0.1) - 2022-12-23
96

CONTRIBUTING.md

Lines changed: 13 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,50 +1,23 @@
11
# Contributing Guidelines
22

3-
Contributions welcome! Please check past issues and pull requests before you open your own issue or pull request to avoid duplicating a frequently asked question.
3+
## Code of Conduct
44

5-
In addition to improving the project, refactoring code, and implementing features, this project welcomes the following types of contributions:
5+
This project is intended to be a safe, welcoming space for collaboration.
66

7-
- **Ideas**: participate in an issue thread or start your own to have your voice heard.
8-
- **Writing**: contribute your expertise in an area by helping expand the included content.
9-
- **Copy editing**: fix typos, clarify language, and generally improve the quality of the content.
10-
- **Formatting**: help keep content easy to read with consistent formatting.
11-
12-
## Install
13-
14-
Fork and clone the repo, then `npm install` to install all dependencies.
15-
16-
## Testing
17-
18-
Tests are run with `npm test`. Please ensure all tests are passing before submitting a pull request (unless you're creating a failing test to increase test coverage or show a problem).
19-
20-
## Code Style
21-
22-
This repository uses [Biome](https://biomejs.dev/) for linting and formatting. `npm test` runs the linter, and `npm run format` applies fixes and formatting for you.
7+
All contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
238

24-
---
9+
Thank you for being kind to each other!
2510

26-
# Collaborating Guidelines
11+
## Contributions welcome!
2712

28-
**This is an OPEN Open Source Project.**
13+
**Before spending lots of time on something, ask for feedback on your idea first!**
2914

30-
## What?
15+
Please search [issues](../../issues/) and [pull requests](../../pulls/) before adding something new! This helps avoid duplicating efforts and conversations.
3116

32-
Individuals making significant and valuable contributions are given commit-access to the project to contribute as they see fit. This project is more like an open wiki than a standard guarded open source project.
17+
This project welcomes any kind of contribution! Here are a few suggestions:
3318

34-
## Rules
35-
36-
There are a few basic ground-rules for contributors:
37-
38-
1. **No `--force` pushes** or modifying the Git history in any way.
39-
1. **Non-master branches** ought to be used for ongoing work.
40-
1. **External API changes and significant modifications** ought to be subject to an **internal pull-request** to solicit feedback from other contributors.
41-
1. Internal pull-requests to solicit feedback are *encouraged* for any other non-trivial contribution but left to the discretion of the contributor.
42-
1. Contributors should attempt to adhere to the prevailing code style.
43-
44-
## Releases
45-
46-
Declaring formal releases remains the prerogative of the project maintainer.
47-
48-
## Changes to this arrangement
49-
50-
This is an experiment and feedback is welcome! This document may also be subject to pull-requests or changes by contributors where you believe you have something valuable to add or change.
19+
- **Ideas**: participate in an issue thread or start your own to have your voice heard.
20+
- **Writing**: contribute your expertise in an area by helping expand the included content.
21+
- **Copy editing**: fix typos, clarify language, and generally improve the quality of the content.
22+
- **Formatting**: help keep content easy to read with consistent formatting.
23+
- **Code**: help maintain and improve the project codebase.

LICENSE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# [ISC License](https://spdx.org/licenses/ISC)
22

3-
Copyright (c) 2016, Nate Goldman <ungoldman@gmail.com>
3+
Copyright (c) 2016-2026, Nate Goldman <ungoldman@gmail.com>
44

55
Permission to use, copy, modify, and/or distribute this software for any
66
purpose with or without fee is hereby granted, provided that the above

README.md

Lines changed: 71 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -128,122 +128,131 @@ Alternately you can run it without arguments and it will look for a `CHANGELOG.m
128128
This module assumes your change log is a [markdown](http://daringfireball.net/projects/markdown/syntax) file structured roughly like so:
129129

130130
```markdown
131-
# changelog title
131+
# Changelog
132132

133-
A cool description (optional).
133+
All notable changes to this project are documented in this file.
134134

135-
## unreleased
136-
* foo
135+
## Unreleased
137136

138-
## x.y.z - YYYY-MM-DD (or DD.MM.YYYY, D/M/YY, etc.)
139-
* bar
137+
* Work in progress.
140138

141-
## [a.b.c]
139+
## 2.2.0-beta.1 - 2024-03-20
142140

143-
### Changes
141+
* Pre-release builds get a version too.
144142

145-
* Update API
146-
* Fix bug #1
143+
## [2.1.0] - 2024-03-15
147144

148-
## 2.2.3-pre.1 - 2013-02-14
149-
* Update API
145+
### Added
150146

151-
## 2.0.0-x.7.z.92 - 2013-02-14
152-
* bark bark
153-
* woof
154-
* arf
147+
* A `format` option, documented in [the README](https://example.com).
148+
* Support for **bold** entries.
155149

156-
## v1.3.0
150+
### Fixed
157151

158-
* make it so
152+
- A crash on empty input.
159153

160-
## [1.2.3](link)
161-
* init
154+
## 2.0.0 (2024-01-02)
162155

163-
[a.b.c]: http://altavista.com
156+
* Drop support for Node 12.
157+
158+
# 1.5.0 - 02.11.2023
159+
160+
* An older entry under an H1 heading with a `DD.MM.YYYY` date.
161+
162+
## v1.0.0
163+
164+
* First stable release.
165+
166+
## [0.9.0](https://example.com/releases/0.9.0)
167+
168+
* Initial public prototype.
169+
170+
[2.1.0]: https://example.com/releases/2.1.0
164171
```
165172

166173
Parsing the above example will return the following object:
167174

168175
```js
169176
{
170-
title: 'changelog title',
171-
description: 'A cool description (optional).',
177+
title: 'Changelog',
178+
description: 'All notable changes to this project are documented in this file.',
172179
versions: [
173180
{ version: null,
174-
title: 'unreleased',
181+
title: 'Unreleased',
175182
date: null,
176-
body: '* foo',
183+
body: '* Work in progress.',
177184
parsed: {
178185
_: [
179-
'foo'
186+
'Work in progress.'
180187
]
181188
}
182189
},
183-
{ version: 'x.y.z',
184-
title: 'x.y.z - YYYY-MM-DD',
185-
date: null,
186-
body: '* bar',
190+
{ version: '2.2.0-beta.1',
191+
title: '2.2.0-beta.1 - 2024-03-20',
192+
date: '2024-03-20',
193+
body: '* Pre-release builds get a version too.',
187194
parsed: {
188195
_: [
189-
'bar'
196+
'Pre-release builds get a version too.'
190197
]
191198
}
192199
},
193-
{ version: 'a.b.c',
194-
title: '[a.b.c]',
195-
date: null,
196-
body: '### Changes\n\n* Update API\n* Fix bug #1',
200+
{ version: '2.1.0',
201+
title: '[2.1.0] - 2024-03-15',
202+
date: '2024-03-15',
203+
body: '### Added\n\n* A `format` option, documented in [the README](https://example.com).\n* Support for **bold** entries.\n\n### Fixed\n\n- A crash on empty input.',
197204
parsed: {
198205
_: [
199-
'Update API',
200-
'Fix bug #1'
206+
'A format option, documented in the README.',
207+
'Support for bold entries.',
208+
'A crash on empty input.'
201209
],
202-
Changes: [
203-
'Update API',
204-
'Fix bug #1'
210+
Added: [
211+
'A format option, documented in the README.',
212+
'Support for bold entries.'
213+
],
214+
Fixed: [
215+
'A crash on empty input.'
205216
]
206217
}
207218
},
208-
{ version: '2.2.3-pre.1',
209-
title: '2.2.3-pre.1 - 2013-02-14',
210-
date: '2013-02-14',
211-
body: '* Update API',
219+
{ version: '2.0.0',
220+
title: '2.0.0 (2024-01-02)',
221+
date: '2024-01-02',
222+
body: '* Drop support for Node 12.',
212223
parsed: {
213224
_: [
214-
'Update API'
225+
'Drop support for Node 12.'
215226
]
216227
}
217228
},
218-
{ version: '2.0.0-x.7.z.92',
219-
title: '2.0.0-x.7.z.92 - 2013-02-14',
220-
date: '2013-02-14',
221-
body: '* bark bark\n* woof\n* arf',
229+
{ version: '1.5.0',
230+
title: '1.5.0 - 02.11.2023',
231+
date: '02.11.2023',
232+
body: '* An older entry under an H1 heading with a `DD.MM.YYYY` date.',
222233
parsed: {
223234
_: [
224-
'bark bark',
225-
'woof',
226-
'arf'
235+
'An older entry under an H1 heading with a DD.MM.YYYY date.'
227236
]
228237
}
229238
},
230-
{ version: '1.3.0',
231-
title: 'v1.3.0',
239+
{ version: '1.0.0',
240+
title: 'v1.0.0',
232241
date: null,
233-
body: '* make it so',
242+
body: '* First stable release.',
234243
parsed: {
235244
_: [
236-
'make it so'
245+
'First stable release.'
237246
]
238247
}
239248
},
240-
{ version: '1.2.3',
241-
title: '[1.2.3](link)',
249+
{ version: '0.9.0',
250+
title: '[0.9.0](https://example.com/releases/0.9.0)',
242251
date: null,
243-
body: '* init',
252+
body: '* Initial public prototype.',
244253
parsed: {
245254
_: [
246-
'init'
255+
'Initial public prototype.'
247256
]
248257
}
249258
}
@@ -253,6 +262,8 @@ Parsing the above example will return the following object:
253262

254263
Expects versions to be [semver](http://semver.org/) compliant, otherwise sets `version` to null.
255264

265+
Both `#` and `##` headings are treated as versions. The version number is read from the heading whether it is bare (`2.1.0`), `v`-prefixed (`v1.0.0`), or wrapped in brackets and optionally linked (`[0.9.0](...)`), and dates are recognized in common formats such as `YYYY-MM-DD`, `DD.MM.YYYY`, and parenthesized `(YYYY-MM-DD)`.
266+
256267
Each entry is available as an object in the `versions` array. The body of a given entry can be accessed using the following properties:
257268

258269
- `body` - A string containing all of the updates/changes/etc. for the current entry. This property includes both plain text and markdown.

0 commit comments

Comments
 (0)