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

gulp-github-changelog

v0.1.0

Published

Gulp tasks for changelog generation from github issues

Downloads

2

Readme

The gulp-github-changelog package provides a few Gulp tasks for automatic changelog generation in markdown format. Unlike other similar implementations, this one uses GitHub milestones and issues for its logic. The !preversion and !postversion tasks should be used for the NPM's preversion and postversion script hooks. The !postversion task publishes the changelog contents in the corresponding GitHub release.

Overview

The generator exposes three gulp tasks - changelog, !preversion, and !postversion. The changelog task is meant to be run manually before the release and updates the contents of the CHANGELOG.md file. The !preversion and !postversion tasks should be attached as script hooks in package.json, so that the npm version command will run them automatically.

changelog

For the changelog task to work as expected, each version should have a matching GitHub milestone in the repository. The milestone name should equal the version name, including "v". For instance, the milestone for version 1.1.0 should be named v1.1.0. The generator fetches all closed milestone issues and lists them as changes for the respective version.

The issues are grouped in three categories - New, Enhancements, and Fixed. The grouping is based on the standard GitHub tags. Issues with no tag are put in the New category.

The task will fail if no milestone is found or if the milestone does not have any closed issues. It also checks if the changelog already contains an entry for that version and aborts the task if so. An optional --force option may be passed to overwrite the existing entry.

The generated changelog is not automatically committed. This is intentional - the publisher should examine the contents, and, if necessary, add some manual edits in addition to the generated ones.

!preversion

The !preversion task performs a few sanity checks and aborts the npm version if something is not right. It will fail when:

  • No changelog entry for the new version is present in the CHANGELOG.md; The changelog task should be run first;
  • Closed issues with no milestone are present. Issues tagged with duplicate, invalid, wontfix or question are ignored. The issues are most likely closed without the correct milestone; you should fix this before publishing;
  • The milestone has any remaining open issues. They should be addressed or moved to the next planned release.

You may put the !preversion task as a prerequisite to another task which will run the unit tests.

!postversion

The !postversion task pushes the version tag to GitHub and publishes the changelog piece to the respective release. It also closes the version milestone.

Installation and usage

Install the package as local dev dependency.

    npm install --save-dev gulp-github-changelog

Make sure that your package.json has the correct repository settings (it will be used for the API calls)

"repository": {
    "type": "git",
    "url": "https://github.com/user/repo.git"
}

Add the preversion and postversion script hooks to package.json:

  "scripts": {
    "preversion": "gulp '!preversion'",
    "postversion": "gulp '!postversion'"
  }

Generate a GitHub token for your account, and make it available as an environment variable:

echo 'source $HOME/.github_token' >> .bashrc # or .zshrc if you use zshell
echo 'export GITHUB_TOKEN="your token here"' >> $HOME/.github_token

Add the following line to your gulpfile.js

const gulp = require('gulp')
require('gulp-github-changelog')(gulp)

Before your release, run the changelog task:

gulp changelog -v your_version [--force]

The your_version parameter accepts the same value as the npm version command.

If the result does not quite fit the bill, fix the issue titles and categories and re-run the task with the --force parameter.

Afterwards, run npm version.