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

smooth-release

v8.0.9

Published

Smart CLI tool to safely and automatically do every step to release a new version of a library hosted on GitHub and published on npm

Downloads

1,122

Readme

smooth-release

Smart CLI utility to safely and automatically do every step to release a new version of a library hosted on GitHub and published on npm.

Install

npm i -g smooth-release

Usage

Simply run smooth-release from your root folder, that's all :)

Custom settings

  • Every config value used by smooth-release is overridable: jump to .smooth-releaserc section to know more about it.
  • You can run or turn off specific tasks also by passing a set of CLI arguments: jump to CLI arguments section to know more about it.

What it does

smooth-release does five main activities in this order:

  1. Run validations
  2. Increase version and push new commit and tag
  3. Generate CHANGELOG.md
  4. Create release on GitHub with link to relative section in CHANGELOG.md
  5. Publish on npm

Run validations

In order to proceed each one of these validations must pass (they can be optionally turned off):

  1. Current branch must be the one defined in .smooth-releaserc (default: "master")
  2. Local branch must be in sync with remote
  3. No uncommited changes in the working tree
  4. No untracked filed in the working tree
  5. User must be logged in "npm" and have write permissions for current package

Increase version

Check if version should be considered "breaking" or not

smooth-release automatically detects if the next version should be "breaking" or not. If a version is "breaking" it will be a major otherwise it will be a patch. smooth-release never creates a minor version.

To decide if a version is "breaking", smooth-release analyzes every closed issue (or merged pull request) from GitHub: if there is at least one valid closed issue marked as "breaking" the version will be breaking.

To mark an issue (or pull request) as "breaking" you can add to it a label named as you like. This label should also be added to smooth-releaserc to let smooth-release know about it.

NOTE: you can use pull requests instead of issues by setting github.dataType in .smooth-releaserc to "pullRequests"

MANUAL OVERRIDE: If you need to, you can override this step by manually passing the desired version/increase level as argument to smooth-release:

smooth-release minor
smooth-release pre-major
smooth-release 5.4.6

npm version and push

Runs:

  1. npm version ${newVersion} --no-git-tag-version

Generate CHANGELOG.md

The script to generate the changelog is basically a replica in JavaScript of github-changelog-generator.

The changelog is generated using closed issues by default. You can use merged pull requests instead by setting github.dataType in .smooth-releaserc to "pullRequests"

This script is stateless: every time it runs it replaces CHANGELOG.md with a new one.

You can see an example by looking at the CHANGELOG.md file on this repo: https://github.com/buildo/smooth-release/blob/master/CHANGELOG.md.

Create release on GitHub with link to CHANGELOG.md section

It statelessly creates a GitHub release for the last npm-version tag.

smooth-release defines an npm-version tag as a tag named v1.2.3 where 1, 2, 3 can be any number.

The release is named after the tag (ex: v1.2.3) and the body contains a link to the relative section in CHANGELOG.md.

You can see an example by looking at any release from this repo: https://github.com/buildo/smooth-release/releases.

Create release commit and push it on origin

This step is run only if there are changes to commit. This may happen if you run one of these scripts:

  • npm-version (modifies package.json)
  • changelog (modifies CHANGELOG.md)

If the only file that changed is CHANGELOG.md the new commit will have as message "Update CHANGELOG.md".

Otherwise, if you run also npm-version script and therefore the package.json has been updated, the new commit will have the standard version message ("1.2.3") and will also have the npm-version tag (v.1.2.3).

Publish on npm

Runs:

  1. npm publish

.smooth-releaserc

smooth-release comes with a safe default for each config value. This is the defaultConfig JSON used by smooth-release:

{
  github: {
    dataType: 'issues',
    changelog: {
      outputPath: './CHANGELOG.md',
      ignoredLabels: ['DX', 'invalid', 'discussion'],
      bug: {
        title: '#### Fixes (bugs & defects):',
        labels: ['bug', 'defect']
      },
      breaking: {
        title: '#### Breaking:',
        labels: ['breaking']
      },
      feature: {
        title: '#### New features:'
      }
    }
  },
  publish: {
    branch: 'master',
    inSyncWithRemote: true,
    noUncommittedChanges: true,
    noUntrackedFiles: true,
    validNpmCredentials: true,
    validGithubToken: true,
    packageFilesFilter: 'files',
    npmVersionConfirmation: true
  },
  tasks: {
    validations: true,
    'npm-publish': null,
    'npm-version': null,
    'gh-release': null,
    'gh-release-all': false,
    changelog: null
  }
}

If you set a task to null, smooth-release will prompt you every time before running the task: image

If you want to change parts of the default config you can define a JSON file in the root directory of your project named .smooth-releaserc.

The file will be recursively merged into defaultConfig (NB: arrays are replaced, not merged!).

CLI arguments

smooth-release can be configured using CLI arguments as well.

The main argument is passed directly to the npm-version task so you can use smooth-release like npm version:

smooth-release minor

You can also override the default behavior of each task by passing it as argument:

Examples

smooth-release --no-npm-publish # safely run "smooth-release" without publishing on "npm"
smooth-release --changelog --gh-release-all # first time using smooth-release on your repo? this way you add a CHANGELOG.md and a GitHub release for every npm verison tag :)

If you specify one ore more negative argument, interactive prompts will be displayed for the remaining arguments (ex: --no-changelog).

If you specify one or more positive argument, all interactive prompts will be disabled and only the whitelisted tasks will be run (ex: --changelog).