Gathering detailed insights and metrics for changelog-parser
Gathering detailed insights and metrics for changelog-parser
Gathering detailed insights and metrics for changelog-parser
Gathering detailed insights and metrics for changelog-parser
conventional-commits-parser
Parse raw conventional commits.
conventional-commits-filter
Filter out reverted commits parsed by conventional-commits-parser.
@types/changelog-parser
TypeScript definitions for changelog-parser
keep-a-changelog
Node package to parse and generate changelogs following the [keepachangelog](https://keepachangelog.com/) format.
npm install changelog-parser
Typescript
Module System
Min. Node Version
Node Version
NPM Version
JavaScript (100%)
Total Downloads
5,203,933
Last Day
5,113
Last Week
24,929
Last Month
108,765
Last Year
1,191,520
ISC License
75 Stars
122 Commits
32 Forks
4 Watchers
2 Branches
10 Contributors
Updated on Aug 30, 2024
Minified
Minified + Gzipped
Latest Version
3.0.1
Package Id
changelog-parser@3.0.1
Unpacked Size
52.29 kB
Size
32.04 kB
File Count
14
NPM Version
8.19.3
Node Version
16.18.0
Cumulative downloads
Total Downloads
Last Day
67.6%
5,113
Compared to previous day
Last Week
-12.9%
24,929
Compared to previous week
Last Month
-6.8%
108,765
Compared to previous month
Last Year
-5.4%
1,191,520
Compared to previous year
2
4
npm install changelog-parser
This module exports a single function. It supports both callbacks and promises.
1var parseChangelog = require('changelog-parser')
If provided with a callback, parseChangelog
will invoke the function with the parsed changelog.
1parseChangelog('path/to/CHANGELOG.md', function (err, result) {
2 if (err) throw err
3
4 // changelog object
5 console.log(result)
6})
If no callback is provided, parseChangelog
will return a Promise.
1parseChangelog('path/to/CHANGELOG.md') 2 .then(function (result) { 3 // changelog object 4 console.log(result) 5 }) 6 .catch(function (err) { 7 // Whoops, something went wrong! 8 console.error(err) 9 })
You can optionally provide a configuration object parseChangelog
function.
You must provide either filePath
or text
.
Path to changelog file.
1parseChangelog({
2 filePath: 'path/to/CHANGELOG.md'
3})
Text of changelog file (you can use this instead of filePath
).
1parseChangelog({
2 text: 'raw changelog text in string format'
3})
Removes the markdown markup from the changelog entries by default. You can change its value to false
to keep the markdown.
1parseChangelog({ 2 filePath: 'path/to/CHANGELOG.md', 3 removeMarkdown: false // default: true 4})
There is also a command-line interface available if you install it with -g
.
npm install -g changelog-parser
This installs a program called changelog-parser
that you simply pass a CHANGELOG.md
file.
changelog-parser path/to/CHANGELOG.md
This will print the JSON object representing the change log to the terminal.
Alternately you can run it without arguments and it will look for a CHANGELOG.md
file in the working directory.
This module assumes your change log is a markdown file structured roughly like so:
1# changelog title 2 3A cool description (optional). 4 5## unreleased 6* foo 7 8## x.y.z - YYYY-MM-DD (or DD.MM.YYYY, D/M/YY, etc.) 9* bar 10 11## [a.b.c] 12 13### Changes 14 15* Update API 16* Fix bug #1 17 18## 2.2.3-pre.1 - 2013-02-14 19* Update API 20 21## 2.0.0-x.7.z.92 - 2013-02-14 22* bark bark 23* woof 24* arf 25 26## v1.3.0 27 28* make it so 29 30## [1.2.3](link) 31* init 32 33[a.b.c]: http://altavista.com
Parsing the above example will return the following object:
1{ 2 title: 'changelog title', 3 description: 'A cool description (optional).', 4 versions: [ 5 { version: null, 6 title: 'unreleased', 7 date: null, 8 body: '* foo', 9 parsed: { 10 _: [ 11 'foo' 12 ] 13 } 14 }, 15 { version: 'x.y.z', 16 title: 'x.y.z - YYYY-MM-DD', 17 date: null, 18 body: '* bar', 19 parsed: { 20 _: [ 21 'bar' 22 ] 23 } 24 }, 25 { version: 'a.b.c', 26 title: '[a.b.c]', 27 date: null, 28 body: '### Changes\n\n* Update API\n* Fix bug #1', 29 parsed: { 30 _: [ 31 'Update API', 32 'Fix bug #1' 33 ], 34 Changes: [ 35 'Update API', 36 'Fix bug #1' 37 ] 38 } 39 }, 40 { version: '2.2.3-pre.1', 41 title: '2.2.3-pre.1 - 2013-02-14', 42 date: '2013-02-14', 43 body: '* Update API', 44 parsed: { 45 _: [ 46 'Update API' 47 ] 48 } 49 }, 50 { version: '2.0.0-x.7.z.92', 51 title: '2.0.0-x.7.z.92 - 2013-02-14', 52 date: '2013-02-14', 53 body: '* bark bark\n* woof\n* arf', 54 parsed: { 55 _: [ 56 'bark bark', 57 'woof', 58 'arf' 59 ] 60 } 61 }, 62 { version: '1.3.0', 63 title: 'v1.3.0', 64 date: null, 65 body: '* make it so', 66 parsed: { 67 _: [ 68 'make it so' 69 ] 70 } 71 }, 72 { version: '1.2.3', 73 title: '[1.2.3](link)', 74 date: null, 75 body: '* init', 76 parsed: { 77 _: [ 78 'init' 79 ] 80 } 81 } 82 ] 83}
Expects versions to be semver compliant, otherwise sets version
to null.
Each entry is available as an object in the versions
array. The body of a given entry can be accessed using the following properties:
body
- A string containing all of the updates/changes/etc. for the current entry. This property includes both plain text and markdown.parsed
- An object which points to one or more arrays of data for the current entry. All data for the current entry is present in the array at key _
(eg. parsed._
). If the entry contains subheadings (eg. ### Added
, ### Changed
), then any items underneath each subheading will be present in an array at the corresponding key (eg. parsed.Added
, parsed.Changed
). Each array contains plain text.CHANGELOG.md
standards are inspired by keepachangelog.com.
Contributions welcome! Please read the contributing guidelines first.
Log image is from emojipedia.
No vulnerabilities found.
No security vulnerabilities found.