Socket
Socket
Sign inDemoInstall

keep-a-changelog

Package Overview
Dependencies
Maintainers
1
Versions
38
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

keep-a-changelog

Node package to parse and generate changelogs following the [keepachangelog](http://keepachangelog.com/en/1.0.0/) format.


Version published
Weekly downloads
6.1K
decreased by-12.85%
Maintainers
1
Weekly downloads
 
Created
Source

keep-a-changelog

Build Status

Node package to parse and generate changelogs following the keepachangelog format.

Install

You can install it from the npm repository using npm/yarn:

npm install keep-a-changelog

Usage

const { parser } = require('keep-a-changelog');
const fs = require('fs');

//Parse a changelog file
const changelog = parser(fs.readFileSync('CHANGELOG.md', 'UTF-8'));

//Generate the new changelog string
console.log(changelog.toString());

Create a new changelog

const { Changelog, Release } = require('keep-a-changelog');

const changelog = new Changelog('My project')
    .addRelease(
        new Release('0.1.0', '2017-12-06')
            .added('New awesome feature')
            .added('New other awesome feature')
            .fixed('Bug #3')
            .removed('Drop support for X')
    )
    .addRelease(
        new Release('0.2.0', '2017-12-09')
            .security('Fixed security vulnerability')
            .deprecated('Feature X is deprecated')
    );

console.log(changelog.toString());

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:

const changelog = new Changelog();
changelog.tagNameBuilder = release => `version-${release.version}`;

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:

changelog

To use other file name:

changelog --file=History.md

To generate an empty new CHANGELOG.md file:

changelog --init

Available options:

OptionDescription
--fileThe markdown file of the changelog. The default value is CHANGELOG.md.
--urlThe 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.
--httpsSet to false to use http instead https in the url (--https=false).
--initInit a new empty changelog file.

Keywords

FAQs

Package last updated on 26 Nov 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc