npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

generate-changelog-with-icons

v1.8.0

Published

Generate a changelog from git commits.

Downloads

3

Readme

Generate Changelog

NPM Version Build Status Coverage Status Dependency Status

Generate a changelog from git commits. This is meant to be used so that for every patch, minor, or major version, you update the changelog prior to running npm version so that the git tag contains the commit that updated both the changelog and version.

Installation

You can either install it as a dev dependency to be referenced in your npm scripts, or you can install this module globally to be used for all of your repos on your local machine.

$ npm i generate-changelog -D # install it as a dev dependency
# OR
$ npm i generate-changelog -g # install it globally

Usage

To use this module, your commit messages have to be in this format:

type(category): description [flags]

Where type is one of the following:

  • breaking
  • build
  • ci
  • chore
  • docs
  • feat
  • fix
  • other
  • perf
  • refactor
  • revert
  • style
  • test

Where flags is an optional comma-separated list of one or more of the following (must be surrounded in square brackets):

  • breaking: alters type to be a breaking change

And category can be anything of your choice. If you use a type not found in the list (but it still follows the same format of the message), it'll be grouped under other.

CLI

You can run this module as a CLI app that prepends the new logs to a file (recommended):

$ changelog -h

  Usage: generate [options]

  Generate a changelog from git commits.

  Options:

    -h, --help             output usage information
    -V, --version          output the version number
    -p, --patch            create a patch changelog
    -m, --minor            create a minor changelog
    -M, --major            create a major changelog
    -t, --tag <range>      generate from specific tag or range (e.g. v1.2.3 or v1.2.3..v1.2.4)
    -x, --exclude <types>  exclude selected commit types (comma separated)
    -f, --file [file]      file to write to, defaults to ./CHANGELOG.md, use - for stdout
    -u, --repo-url [url]   specify the repo URL for commit links, defaults to checking the package.json
    -a, --allow-unknown    allow unknown commit types

It's possible to create a ./CHANGELOG.md file for a specific commit range:

generate-changelog 420c945...2a83752

Git tags are supported too:

generate-changelog release/3.1.2822...release/3.1.2858

Code

You can write a script that calls the generate function and does whatever you want with the new logs:

var Changelog = require('generate-changelog');
var Fs        = require('fs');

return Changelog.generate({ patch: true, repoUrl: 'https://github.com/lob/generate-changelog' })
.then(function (changelog) {
  Fs.writeFileSync('./CHANGELOG.md', changelog);
});

Recommended

The way that I would recommend using this module would be the way it's being used in this module: as npm scripts. You should install it as a dev dependency and then add the following to the scripts object in your package.json:

"release:major": "changelog -M && git add CHANGELOG.md && git commit -m 'updated CHANGELOG.md' && npm version major && git push origin && git push origin --tags",
"release:minor": "changelog -m && git add CHANGELOG.md && git commit -m 'updated CHANGELOG.md' && npm version minor && git push origin && git push origin --tags",
"release:patch": "changelog -p && git add CHANGELOG.md && git commit -m 'updated CHANGELOG.md' && npm version patch && git push origin && git push origin --tags",

GitHub Actions

You can run this module in a GitHub Actions workflow using the generate-changelog-action Action.

Testing

To run the test suite, just clone the repository and run the following:

$ npm i
$ npm test

Contributing

To contribute, please see the CONTRIBUTING.md file.

License

This project is released under the MIT license, which can be found in LICENSE.txt.