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

version-and-release

v0.1.1

Published

Tools for maintaining releases of a multi-repo project

Downloads

4

Readme

version-and-release

Tools for automating maintenance of a multi-repo project.

The main export (and the included bin/generate-release-notes script) generates release notes of all the dependency changes that you main package release contains.

The script compares package.json files from your previous version and the current one, finds all updated dependencies. Then gets all the tags that the dependencies changes contain, and loads their release notes. The output of the script is a string containing grouped by priority (major|minor|patch) release notes. The output can be customized with a template (see template option).

Usage

To generate release notes of all the dependency changes that you main package release contains:

const getReleaseNotes = require('version-and-release');
const options = {
  token: "your github token",
  owner: "canjs",
  repo: "canjs",
};
const output = getReleaseNotes('v6.3.0', 'v6.4.0', options);
// >>> "# Major \n ## [can-connect v2.0.0](https://github.com/canjs/can-connect/releases/tag/v6.0.0) ..."

Note: default value for both repo and owner is "canjs". Default (and the only implemented) git provider is "github".

Default template

The default template src/release-template.js formats output like this (demo):

# Major

## [<packageName> <version> - <description>](url-to-release)
<body>
...

# Minor

## [<packageName> <version> - <description>](url-to-release)
<body>
...

# Patch

- [<packageName> <version> - <description>](url-to-release)

- [<packageName> <version> - <description>](url-to-release)
...

All options:

Function getReleaseNotes takes 3 arguments:

  1. Previous release version.
  2. Current release version.
  3. Options, an object with the following props:
  • token, a string with auth token (for GitHub see https://github.com/blog/1509-personal-api-tokens);
  • owner, a string with owner account name;
  • repo, a string with repository name;
  • provider, a string to choose what git provider to use (e.g. "github, "gitlab"); default "github";
  • template, a function that should expect changes grouped by priority (see default template);
  • maxTagsToLoad, a number that limits how many tags to load per dependency package; default 30, for GitHub max is 100;
  • maxTagsToInclude, a number that limits how many releases of every dependency package to include; default 10.

CLI usage

After adding the package to you dev dependencies you can access the node script from node_modules/.bin folder:

$ node_modules/.bin/generate-release-notes \
    --token=<token> \
    --repo=canjs \
    --owner=canjs \
    --template="../test/sample-template.js" \
    --provider=github \
    v6.3.0 v6.4.0

or using single char aliases:

$ node_modules/.bin/generate-release-notes \
    -T <token> \
    -r canjs \
    -o canjs \
    -t "../test/sample-template.js" \
    -p github \
    v6.3.0 v6.4.0

Demo

  1. Add the package to your project:
$ cd canjs
$ npm add --save-dev "version-and-release";
  1. Run script for CanJS (default repo) releases v6.3.0 to v6.4.0:
$ node_modules/.bin/generate-release-notes -T <token> \
v6.3.0 v6.4.0

Intermediary info with updated dependencies looks like this:

{ 
  'can-connect': { currentVer: '4.0.2', prevVer: '4.0.1' },
  'can-event-queue': { currentVer: '1.1.8', prevVer: '1.1.7' },
  'can-observable-array': { currentVer: '1.0.7', prevVer: '1.0.6' },
  'can-queues': { currentVer: '1.3.2', prevVer: '1.3.1' },
  'can-view-live': { currentVer: '5.0.4', prevVer: '5.0.3' } 
}
  1. The output that gets passed to the template script is below.

You can also provide a path to your own template using --template option, otherwise the default template will be used.

{ 
  major: [],
  minor: [],
  patch: 
   [ { packageName: 'can-observable-array',
       version: 'v1.0.7',
       type: 'patch',
       previousRelease: 'v1.0.6',
       currentRelease: 'v1.0.7',
       previousReleaseSha: '273bb9710742e7ef128cca712f6c43759e95d68c',
       currentReleaseSha: 'd541e32aaefb07e917b454fab343a535cda04d17',
       title: 'Update listening to event documentation',
       htmlUrl: 'https://github.com/canjs/can-observable-array/releases/tag/v1.0.6',
       body: 'Fix listening to event documentation.\r\n\r\n#77 ' },
     { packageName: 'can-connect',
       version: 'v4.0.2',
       type: 'patch',
       previousRelease: 'v4.0.1',
       currentRelease: 'v4.0.2',
       previousReleaseSha: 'dfdd0efd9c4f75a3235b103a8f75a235580dfa43',
       currentReleaseSha: '1b63e95ec9794231d367f6f77774634d4f7e783b',
       title: 'Move packages as devDependencies ',
       htmlUrl: 'https://github.com/canjs/can-connect/releases/tag/v4.0.2',
       body: 'move `can-observable-*` packages to development dependencies (`devDependencies`)\r\n\r\n#512' },
     { packageName: 'can-view-live',
       version: 'v5.0.4',
       type: 'patch',
       previousRelease: 'v5.0.3',
       currentRelease: 'v5.0.4',
       previousReleaseSha: '05ea9509cac646e8441a35f9c0a9f65f9df553b6',
       currentReleaseSha: 'b0735a2e2eda299e87a7478da1e3536e4ec97cf7',
       title: '',
       body: '' },
     { packageName: 'can-queues',
       version: 'v1.3.2',
       type: 'patch',
       previousRelease: 'v1.3.1',
       currentRelease: 'v1.3.2',
       previousReleaseSha: 'e27022c41ef3d5c62583736704134b2c81a83daa',
       currentReleaseSha: 'b2defc22da322e3f038f0f8b3d85e05a8312469e',
       title: '',
       body: '' },
     { packageName: 'can-event-queue',
       version: 'v1.1.8',
       type: 'patch',
       previousRelease: 'v1.1.7',
       currentRelease: 'v1.1.8',
       previousReleaseSha: '4ad393f51702cf64090a8741b7fc1ce9a42f2753',
       currentReleaseSha: '86c70820688691e2d4ed10cc040b331a9512db34',
       title: 'Fix a typo in the documentation',
       body: 'For documentation needs, fix the `isntance` wording to `instance`.' } ] 
}