Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

smooth-release

buildo287ISC8.0.9

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

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.

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).

changelog

Change Log

v8.0.9 (2019-01-10)

Full Changelog

Fixes (bugs & defects):

  • publish with pack does not work for organization's packages #113

v8.0.8 (2018-12-06)

Full Changelog

Fixes (bugs & defects):

  • throws error without a .smooth-releaserc well configured file #111

v8.0.7 (2018-11-23)

Full Changelog

Fixes (bugs & defects):

  • publish with tar package fails #109

v8.0.6 (2018-11-23)

Full Changelog

Fixes (bugs & defects):

  • Does not work if called from yarn #107

v8.0.5 (2017-12-13)

Full Changelog

Fixes (bugs & defects):

  • version script ignores changelog.ignoredLabels #103

New features:

  • add docs for #99 #101
  • Preview package files and validate against package.json #93

v8.0.4 (2017-06-07)

Full Changelog

New features:

  • human validation of computed version should be optional #98
  • Optionally use pull requests instead of issues #91

v8.0.3 (2017-04-18)

Full Changelog

Fixes (bugs & defects):

  • Support git origins that are missing the suffix ".git" #89

v8.0.2 (2017-04-14)

Full Changelog

Fixes (bugs & defects):

  • typo: "assure" instead of "ensure" #87

v8.0.1 (2017-04-05)

Full Changelog

New features:

  • Use update-notifier to notify users when a new version is available #66

v8.0.0 (2017-03-24)

Full Changelog

Breaking:

  • "files" should be the default for config.packageFilesFilter validations #83

v7.0.3 (2017-03-24)

Full Changelog

New features:

  • add validation for .npmignore or package.json's files #69

v7.0.2 (2017-03-24)

Full Changelog

Fixes (bugs & defects):

  • npm validation does not handle org teams #80
  • Error messages not displayed properly on node 7 #64

New features:

  • add validation for github access_token #78

v7.0.1 (2017-02-24)

Full Changelog

Fixes (bugs & defects):

  • --no-npm-publish does not disable npm validation #72
  • Changelog does not consider the new tag added by npm-version task #68

New features:

  • add command to show version #71

v7.0.0 (2017-01-27)

Full Changelog

Fixes (bugs & defects):

  • Shouldn't crash if tag already exists #62

New features:

  • add "validation" to check if user has valid npm credentials for package #58

Breaking:

  • Changelog is committed after the tag #53

v6.0.0 (2017-01-03)

Full Changelog

Breaking:

  • Add interactive questions for each step #52

v5.0.4 (2017-01-02)

Full Changelog

Fixes (bugs & defects):

  • Changelog: some Issues are put under the wrong tag #54

v5.0.3 (2016-12-07)

Full Changelog

Fixes (bugs & defects):

  • --no-validation and --no-npm-publish CLI args don't work #50

v5.0.2 (2016-12-05)

Full Changelog

New features:

  • allow passing token as CLI argument #48

v5.0.1 (2016-11-25)

Full Changelog

New features:

  • pass version manually #46

v5.0.0 (2016-11-25)

Full Changelog

Breaking:

  • split publish.js in multiple sub-modules #44

v4.0.2 (2016-11-13)

Full Changelog

Fixes (bugs & defects):

  • fix status logs once and for all #42

v4.0.1 (2016-11-12)

Full Changelog

Fixes (bugs & defects):

  • only first "info" subtitle is logged! #40

v4.0.0 (2016-11-12)

Full Changelog

Breaking:

  • default config should be enough to run smooth-release without errors #38
  • add validation for untracked files #33
  • add validation for uncommitted changes #32

Fixes (bugs & defects):

  • elegant-status sometimes doesn't show ongoing step #36

v3.0.0 (2016-11-12)

Full Changelog

Breaking:

  • Add confirmation step before publishing to npm #30

New features:

  • Replace node-status with elegant-status #28

v2.0.2 (2016-11-10)

Full Changelog

New features:

  • gh-release should optionally add release for every version tag #26

v2.0.1 (2016-11-05)

Full Changelog

Fixes (bugs & defects):

  • gh-release always fails when run after publish #24

v2.0.0 (2016-11-04)

Full Changelog

Breaking:

  • GitHub token should be global #22

v1.0.6 (2016-11-03)

Full Changelog

Fixes (bugs & defects):

  • add missing "babel-runtime" dep #20

v1.0.5 (2016-11-03)

Full Changelog

Fixes (bugs & defects):

  • Changelog: output is outdated #18

New features:

  • Improve logs #16

v1.0.4 (2016-11-02)

Full Changelog

New features:

  • Changelog: add date time to tags #14

Fixes (bugs & defects):

  • Changelog: issues are placed in wrong tag section #12
  • Default: changelog should be generated before running gh-release script #10

Breaking:

  • Changelog: push CHANGELOG.md after generating it #8

v1.0.3 (2016-10-30)

Full Changelog

Fixes (bugs & defects):

  • Changelog: issue link should point to html page #6

v1.0.2 (2016-10-24)

Full Changelog

Fixes (bugs & defects):

  • Changelog: should not list PRs #4
  • Changelog: issues are always considered "breaking" #2

New features:

  • Improve logs with node-status #1

v1.0.1 (2016-10-24)