Installations
npm install keep-a-changelog
Developer Guide
Typescript
Yes
Module System
CommonJS, ESM
Node Version
20.6.1
NPM Version
9.8.1
Score
82.1
Supply Chain
99.3
Quality
76.2
Maintenance
100
Vulnerability
100
License
Releases
Contributors
Unable to fetch Contributors
Languages
TypeScript (100%)
Developer
oscarotero
Download Statistics
Total Downloads
710,717
Last Day
1,653
Last Week
6,673
Last Month
23,832
Last Year
315,944
GitHub Statistics
62 Stars
161 Commits
21 Forks
5 Watching
3 Branches
11 Contributors
Bundle Size
13.36 kB
Minified
4.28 kB
Minified + Gzipped
Package Meta Information
Latest Version
2.5.3
Package Id
keep-a-changelog@2.5.3
Unpacked Size
562.50 kB
Size
91.09 kB
File Count
278
NPM Version
9.8.1
Node Version
20.6.1
Publised On
19 Nov 2023
Total Downloads
Cumulative downloads
Total Downloads
710,717
Last day
49.5%
1,653
Compared to previous day
Last week
15.8%
6,673
Compared to previous week
Last month
-12%
23,832
Compared to previous month
Last year
118.5%
315,944
Compared to previous year
Daily Downloads
Weekly Downloads
Monthly Downloads
Yearly Downloads
Dependencies
1
Dev Dependencies
2
Changelog
Keep a Changelog library for Node & Deno
Deno package to parse and generate changelogs following the keepachangelog format.
Usage in Node
1import { parser } from "keep-a-changelog"; 2import fs from "fs"; 3 4//Parse a changelog file 5const changelog = parser(fs.readFileSync("CHANGELOG.md", "UTF-8")); 6 7//Generate the new changelog string 8console.log(changelog.toString());
Usage in Deno
1import { parser } from "https://deno.land/x/changelog@v2.2.1/mod.ts"; 2 3//Parse a changelog file 4const changelog = parser(await Deno.readTextFile("CHANGELOG.md")); 5 6//Generate the new changelog string 7console.log(changelog.toString());
Create a new changelog
1import { 2 Changelog, 3 Release, 4} from "https://deno.land/x/changelog@v2.2.1/mod.ts"; 5 6const changelog = new Changelog("My project") 7 .addRelease( 8 new Release("0.1.0", "2017-12-06") 9 .added("New awesome feature") 10 .added("New other awesome feature") 11 .fixed("Bug #3") 12 .removed("Drop support for X"), 13 ) 14 .addRelease( 15 new Release("0.2.0", "2017-12-09") 16 .security("Fixed security vulnerability") 17 .deprecated("Feature X is deprecated"), 18 ); 19 20console.log(changelog.toString());
Custom output format
By default, the output format of the markdown is "compact", that removes the
space after the headings. You can change it to follow the
markdownlint
rules:
1const changelog = new Changelog(); 2changelog.format = "markdownlint";
Custom tag names
By default, the tag names are v
+ version number. For example, the tag for the
version 2.4.9
is v2.4.9
. To change this behavior, set a new
tagNameBuilder
:
1const changelog = new Changelog(); 2changelog.tagNameBuilder = (release) => `version-${release.version}`;
Custom compare links
By default, compare links are build compliant with GitHub format. To change this
behavior, set a new compareLinkBuilder
:
1const changelog = new Changelog(); 2changelog.url = "https://bitbucket.org/oscarotero/keep-a-changelog"; 3changelog.compareLinkBuilder = (previous, release) => 4 `${this.url}/branches/compare/${release.version}%0D${previous.version}`;
Custom Change Types
By default and according to the keepachangelog
format, the change types are Added
, Changed
, Deprecated
, Removed
,
Fixed
, and Security
.
In case you'd like add another type, you need to extend the Release
class to
support new types. Additionally, you have to tell the parser
that it should
create instances of your new extended Release
in order to parse your changelog
correctly.
For example, we would like to add a type Maintenance
. Extend the provided
Release
class:
1class CustomRelease extends Release { 2 constructor(version, date, description) { 3 super(version, date, description); 4 // add whatever types you want - in lowercase 5 const newChangeTypes = [ 6 ["maintenance", []], 7 ]; 8 9 this.changes = new Map([...this.changes, ...newChangeTypes]); 10 } 11 // for convenience, add a new method to add change of type 'maintanance' 12 maintenance(change) { 13 return this.addChange("maintenance", change); 14 } 15}
And once you want to use the parser:
1const releaseCreator = (ver, date, desc) => new CustomRelease(ver, date, desc);
2const changelog = parser(changelogTextContent, { releaseCreator });
Cli
This library provides the changelog
command to normalize the changelog format.
It reads the CHANGELOG.md file and override it with the new format:
Install the library as script
Deno:
1deno install --allow-read --allow-write -fr --name changelog https://deno.land/x/changelog/bin.ts
Node:
1npm install keep-a-changelog -g
Run the script:
1changelog
To use other file name:
1changelog --file=History.md
To generate an empty new CHANGELOG.md file:
1changelog --init
You can release automatically the latest "Unreleased" version:
1changelog --release
If your "Unreleased" section has no version, you can specify it as an argument:
1changelog --release 2.0.0
And return the latest released version:
1changelog --latest-release 2> 2.0.0
Available options:
Option | Description |
---|---|
--format | The output format for the generated markdown. It can be markdownlint or compact . The default value is compact . |
--file | The markdown file of the changelog. The default value is CHANGELOG.md . |
--url | The base url used to build the diff urls of the different releases. It is taken from the existing diff urls in the markdown. If no urls are found, try to catch it using the url of the git remote repository. |
--https | Set to false to use http instead https in the url (--https=false ). |
--init | Init a new empty changelog file. |
--latest-release | Print the latest release version. |
--release | Updated the latest unreleased version with the current date. Use --release=X.Y.Z to set a number if the version doesn't have it. |
--create | Create a new Unreleased version. Use --create=X.Y.Z to specify a version number or just --create for a version without number. |
--quiet | Do not output error messages |
--head | Customize the head reference |
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
no dangerous workflow patterns detected
Reason
license file detected
Details
- Info: project has a license file: LICENSE:0
- Info: FSF or OSI recognized license: MIT License: LICENSE:0
Reason
0 existing vulnerabilities detected
Reason
3 commit(s) and 2 issue activity found in the last 90 days -- score normalized to 4
Reason
Found 6/23 approved changesets -- score normalized to 2
Reason
detected GitHub workflow tokens with excessive permissions
Details
- Warn: no topLevel permission defined: .github/workflows/release.yml:1
- Warn: no topLevel permission defined: .github/workflows/test.yml:1
- Info: no jobLevel write permissions found
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/release.yml:14: update your workflow using https://app.stepsecurity.io/secureworkflow/oscarotero/keep-a-changelog/release.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/release.yml:17: update your workflow using https://app.stepsecurity.io/secureworkflow/oscarotero/keep-a-changelog/release.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/test.yml:11: update your workflow using https://app.stepsecurity.io/secureworkflow/oscarotero/keep-a-changelog/test.yml/master?enable=pin
- Warn: third-party GitHubAction not pinned by hash: .github/workflows/test.yml:14: update your workflow using https://app.stepsecurity.io/secureworkflow/oscarotero/keep-a-changelog/test.yml/master?enable=pin
- Info: 0 out of 3 GitHub-owned GitHubAction dependencies pinned
- Info: 0 out of 1 third-party GitHubAction dependencies pinned
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
- Warn: no security policy file detected
- Warn: no security file to analyze
- Warn: no security file to analyze
- Warn: no security file to analyze
Reason
project is not fuzzed
Details
- Warn: no fuzzer integrations found
Reason
branch protection not enabled on development/release branches
Details
- Warn: branch protection not enabled for branch 'master'
- Warn: branch protection not enabled for branch 'deno'
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
- Warn: 0 commits out of 13 are checked with a SAST tool
Score
4
/10
Last Scanned on 2025-01-20
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 MoreOther packages similar to keep-a-changelog
@release-it/keep-a-changelog
Keep-a-changelog plugin for release-it
@slavkojos/keep-a-changelog
[Keep a Changelog](https://github.com/oscarotero/keep-a-changelog) library for Node & Deno
@metamask/auto-changelog
Utilities for validating and updating "Keep a Changelog" formatted changelogs
git-cliff-linux-x64
A highly customizable Changelog Generator that follows Conventional Commit specifications ⛰️