• Stars
    star
    543
  • Rank 81,848 (Top 2 %)
  • Language
    JavaScript
  • License
    MIT License
  • Created almost 9 years ago
  • Updated 12 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Generate a changelog from git commits.

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.

More Repositories

1

pg_insights

A collection of convenient SQL for monitoring Postgres database health.
TSQL
299
star
2

lambda-pdftk-example

Example project that runs PDFtk in AWS Lambda
JavaScript
100
star
3

lob-ruby

Ruby Wrapper for Lob API
Ruby
97
star
4

lob-node

Node.js Wrapper for Lob API
JavaScript
84
star
5

lob-python

Python Wrapper for Lob API
Python
79
star
6

lob-php

PHP Client for Lob API
PHP
67
star
7

hapi-bookshelf-models

NO LONGER SUPPORTED
JavaScript
35
star
8

litmus

Data schema validation in Elixir
Elixir
34
star
9

examples

HTML Examples for use with Lob Print & Mail APIs
HTML
22
star
10

intern-interviews

HTML
21
star
11

lob-java

Java Wrapper for Lob API
Java
19
star
12

ui-components

Lob's Vue component library
Vue
17
star
13

hapi-rate-limiter

JavaScript
16
star
14

lob-elixir

Elixir Library for Lob API
Elixir
15
star
15

aws-creds

CLI tool to authenticate with Okta as the IdP to fetch AWS credentials
Go
12
star
16

lob-typescript-sdk

TypeScript
10
star
17

lob-openapi

OpenAPI v3 spec for Lob API
JavaScript
8
star
18

nomad-autoscaler-cloudwatch-apm

Nomad Autoscaler APM Plugin for AWS Cloudwatch
Go
7
star
19

react-address-autocomplete

React Autocomplete component for Lob Address Autocomplete
JavaScript
6
star
20

usps-webtools-api

Open source documentation for USPS Web Tools API
JavaScript
6
star
21

pdffonts

Node bindings for Poppler's pdffonts CLI
JavaScript
4
star
22

lob-address-elements

A JavaScript library that adds address autocompletion and verification to a standard HTML Web form.
JavaScript
4
star
23

medusa-next-address-autocomplete

Next starter project for MedusaJS and Lob Address Autocomplete
JavaScript
3
star
24

action_sam_jackson

Respond to comments/issues with a message and a gif of Samuel L. Jackson
JavaScript
3
star
25

fluent-plugin-json-transform

A plugin for doing arbitrary transformation on input JSON.
Ruby
3
star
26

address-elements

JavaScript
3
star
27

lob-go

Go wrapper for Lob API
Go
3
star
28

hapi-bookshelf-total-count

Hapi plugin used with Bookshelf models to calculate the total number of records that match a query and appends it to the response
JavaScript
3
star
29

react-lob-address-autocomplete

JavaScript
1
star
30

vue-address-autocomplete

JavaScript
1
star
31

pdf-wrapper-template

A template for the pdf-wrapper interview question
TypeScript
1
star
32

lob-node-examples

JavaScript
1
star
33

typed

CLI tool for typescript tasks & migrations
Python
1
star
34

lob-dotnet

.NET Wrapper for Lob API
C#
1
star