Gathering detailed insights and metrics for conventional-changelog-writer
Gathering detailed insights and metrics for conventional-changelog-writer
Generate changelogs and release notes from a project's commit messages and metadata.
npm install conventional-changelog-writer
Typescript
Module System
Min. Node Version
Node Version
NPM Version
96
Supply Chain
99.5
Quality
82.5
Maintenance
100
Vulnerability
99.6
License
git-client: v1.0.1
Updated on May 06, 2024
conventional-changelog: v6.0.0
Updated on May 03, 2024
conventional-changelog-core: v8.0.0
Updated on May 03, 2024
conventional-changelog-conventionalcommits: v8.0.0
Updated on May 03, 2024
git-semver-tags: v8.0.0
Updated on May 03, 2024
conventional-changelog-preset-loader: v5.0.0
Updated on May 03, 2024
TypeScript (56.7%)
JavaScript (40.52%)
Handlebars (2.78%)
Love this project? Help keep it running — sponsor us today! 🚀
Total Downloads
740,424,459
Last Day
722,157
Last Week
4,513,509
Last Month
18,323,009
Last Year
194,139,085
ISC License
7,979 Stars
1,722 Commits
724 Forks
56 Watchers
29 Branches
148 Contributors
Updated on Feb 15, 2025
Latest Version
8.0.0
Package Id
conventional-changelog-writer@8.0.0
Unpacked Size
87.13 kB
Size
22.66 kB
File Count
49
NPM Version
10.5.0
Node Version
18.20.2
Published on
May 03, 2024
Cumulative downloads
Total Downloads
Last Day
2%
722,157
Compared to previous day
Last Week
5.7%
4,513,509
Compared to previous week
Last Month
35.3%
18,323,009
Compared to previous month
Last Year
25.2%
194,139,085
Compared to previous year
Write logs based on conventional commits and templates.
1# pnpm 2pnpm add conventional-changelog-writer 3# yarn 4yarn add conventional-changelog-writer 5# npm 6npm i conventional-changelog-writer
1import { 2 writeChangelogString, 3 writeChangelog, 4 writeChangelogStream 5} from 'conventional-changelog-writer' 6import { pipeline } from 'stream/promises' 7 8// to write changelog from commits to string: 9console.log(await writeChangelogString(commits, context, options)) 10 11// to write changelog from commits to async iterable: 12await pipeline( 13 commits, 14 writeChangelog(context, options), 15 async function* (changelog) { 16 for await (const chunk of changelog) { 17 console.log(chunk) 18 } 19 } 20) 21 22// to write changelog from commits to stream: 23commitsStream 24 .pipe(writeChangelogStream(context, options)) 25 .pipe(process.stdout)
Commits it an async iterable of commit objects that looks like this:
1{ hash: '9b1aff905b638aa274a5fc8f88662df446d374bd', 2 header: 'feat(scope): broadcast $destroy event on scope destruction', 3 type: 'feat', 4 scope: 'scope', 5 subject: 'broadcast $destroy event on scope destruction', 6 body: null, 7 footer: 'Closes #1', 8 notes: [], 9 references: [ { action: 'Closes', owner: null, repository: null, issue: '1', raw: '#1' } ] } 10{ hash: '13f31602f396bc269076ab4d389cfd8ca94b20ba', 11 header: 'feat(ng-list): Allow custom separator', 12 type: 'feat', 13 scope: 'ng-list', 14 subject: 'Allow custom separator', 15 body: 'bla bla bla', 16 footer: 'BREAKING CHANGE: some breaking change', 17 notes: [ { title: 'BREAKING CHANGE', text: 'some breaking change' } ], 18 references: [] }
Parts of the commits will be formatted and combined into a log based on the handlebars context, templates and options.
The output log might look something like this:
1## 0.0.1 "this is a title" (2015-05-29) 2 3 4### Features 5 6* **ng-list:** Allow custom separator ([13f3160](https://github.com/a/b/commits/13f3160)) 7* **scope:** broadcast $destroy event on scope destruction ([9b1aff9](https://github.com/a/b/commits/9b1aff9)), closes [#1](https://github.com/a/b/issues/1) 8 9 10### BREAKING CHANGES 11 12* some breaking change
Creates an async generator function to generate changelog entries from commits.
If includeDetails
is true
, instead of emitting strings of changelog, it emits objects containing the details the block.
Creates a transform stream which takes commits and outputs changelog entries.
If includeDetails
is true
, instead of emitting strings of changelog, it emits objects containing the details the block.
Create a changelog from commits.
Variables that will be interpolated to the template. This object contains, but not limits to the following fields.
Type: string
Version number of the up-coming release. If version
is found in the last commit before generating logs, it will be overwritten.
Type: string
Type: boolean
Default: semver.patch(context.version) !== 0
By default, this value is true if version
's patch is 0
.
Type: string
The hosting website. Eg: 'https://github.com'
or 'https://bitbucket.org'
Type: string
The owner of the repository. Eg: 'stevemao'
.
Type: string
The repository name on host
. Eg: 'conventional-changelog-writer'
.
Type: string
The whole repository url. Eg: 'https://github.com/conventional-changelog/conventional-changelog-writer'
.
Should be used as a fallback when context.repository
doesn't exist.
Type: boolean
Default: true
if (context.repository
or context.repoUrl
), context.commit
and context.issue
are truthy
Should all references be linked?
Type: string
Default: 'commits'
Commit keyword in the url if context.linkReferences === true
.
Type: string
Default: 'issues'
Issue or pull request keyword in the url if context.linkReferences === true
.
Type: string
Default: formatted ('yyyy-mm-dd'
) today's date in timezone set by timeZone
option.
If version
is found in the last commit, committerDate
will overwrite this.
Writer options.
Type: function
Default: defaultCommitTransform
exported function.
A function to transform commits. Should return diff object which will be merged with the original commit.
Type: string
Default: 'type'
How to group the commits. EG: based on the same type. If this value is falsy, commits are not grouped.
Type: function
, string
or array
A compare function used to sort commit groups. If it's a string or array, it sorts on the property(ies) by localeCompare
. Will not sort if this is a falsy value.
Type: function
, string
or array
Default: 'header'
A compare function used to sort commits. If it's a string or array, it sorts on the property(ies) by localeCompare
. Will not sort if this is a falsy value.
Type: function
, string
or array
Default: 'title'
A compare function used to sort note groups. If it's a string or array, it sorts on the property(ies) by localeCompare
. Will not sort if this is a falsy value.
Type: function
, string
or array
Default: 'text'
A compare function used to sort note groups. If it's a string or array, it sorts on the property(ies) by localeCompare
. Will not sort if this is a falsy value.
Type: function
, string
or null
Default: if commit.version
is a valid semver.
When the upstream finishes pouring the commits it will generate a block of logs if doFlush
is true
. However, you can generate more than one block based on this criteria (usually a version) even if there are still commits from the upstream.
If this value is a string
, it checks the existence of the field. Set to null
to disable it.
NOTE: It checks on the transformed commit chunk instead of the original one (you can check on the original by access the raw
object on the commit
). However, if the transformed commit is ignored it falls back to the original commit.
Type: function
Default: pass through
Last chance to modify your context before generating a changelog.
Type: function
Default: () => {}
A function to get debug information.
Type: boolean
Default: false
The normal order means reverse chronological order. reverse
order means chronological order. Are the commits from upstream in the reverse order? You should only worry about this when generating more than one blocks of logs based on generateOn
. If you find the last commit is in the wrong block inverse this value.
Type: boolean
Default: true
If true
, reverted commits will be ignored.
Type: boolean
Default: true
If true
, the stream will flush out the last bit of commits (could be empty) to changelog.
Type: string
Default: template.hbs
The main handlebars template.
Type: string
Default: header.hbs
Type: string
Default: commit.hbs
Type: string
Default: footer.hbs
Type: object
Partials that used in the main template, if any. The key should be the partial name and the value should be handlebars template strings. If you are using handlebars template files, read files by yourself.
Type: string
Default: 'UTC'
The timezone to use. The date in the changelog is generated based on timezone.
It is possible to customize this the changelog to suit your needs. Templates are written in handlebars. You can customize all partials or the whole template. Template variables are from either upstream
or context
. The following are a suggested way of defining variables.
Variables in upstream are commit specific and should be used per commit. Eg: commit date and commit username. You can think of them as "local" or "isolate" variables. A "raw" commit message (original commit poured from upstream) is attached to commit
. transform
can be used to modify a commit.
context should be module specific and can be used across the whole log. Thus these variables should not be related to any single commit and should be generic information of the module or all commits. Eg: repository url and author names, etc. You can think of them as "global" or "root" variables.
Basically you can make your own templates and define all your template context. Extra context are based on commits from upstream and options
. For more details, please checkout handlebars and the source code of this module. finalizeContext
can be used at last to modify context before generating a changelog.
1$ conventional-changelog-writer --help # for more details
It works with Line Delimited JSON.
If you have commits.ldjson
1{"hash":"9b1aff905b638aa274a5fc8f88662df446d374bd","header":"feat(ngMessages): provide support for dynamic message resolution","type":"feat","scope":"ngMessages","subject":"provide support for dynamic message resolution","body":"Prior to this fix it was impossible to apply a binding to a the ngMessage directive to represent the name of the error.","footer":"BREAKING CHANGE: The `ngMessagesInclude` attribute is now its own directive and that must be placed as a **child** element within the element with the ngMessages directive.\nCloses #10036\nCloses #9338","notes":[{"title":"BREAKING CHANGE","text":"The `ngMessagesInclude` attribute is now its own directive and that must be placed as a **child** element within the element with the ngMessages directive."}],"references":[{"action":"Closes","owner",null,"repository":null,"issue":"10036","raw":"#10036"},{"action":"Closes","owner":null,"repository":null,"issue":"9338","raw":"#9338"}]}
And you run
1$ conventional-changelog-writer commits.ldjson -o options.js
The output might look something like this
1# 1.0.0 (2015-04-09) 2 3 4### Features 5 6* **ngMessages:** provide support for dynamic message resolution 9b1aff9, closes #10036 #9338 7 8 9### BREAKING CHANGES 10 11* The `ngMessagesInclude` attribute is now its own directive and that must be placed as a **child** element within the element with the ngMessages directive.
It is printed to stdout.
MIT © Steve Mao
No vulnerabilities found.
Reason
no dangerous workflow patterns detected
Reason
26 commit(s) and 2 issue activity found in the last 90 days -- score normalized to 10
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
Found 9/13 approved changesets -- score normalized to 6
Reason
6 existing vulnerabilities detected
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Score
Last Scanned on 2025-02-10
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More