Package detail

@sportheroes/bk-standard-version

sportheroes2.6kISC5.3.4

Replacement for npm version with automatic CHANGELOG generation

conventional-changelog, recommended, changelog, automatic

readme

Standard Version

stop using npm version, use standard-version it rocks!

Automatic versioning, CHANGELOG generation, and conventional commit messages.

Based on bk-conventional-changelog and bk-conventional-recommended-bump.

How it works

When you're ready to release to npm:

  1. git checkout master; git pull origin master
  2. run standard-version
  3. git push --follow-tags origin master; npm publish

standard-version does the following:

  1. bumps the version in package.json/bower.json (based on your commit history)
  2. uses conventional-changelog to update CHANGELOG.md using SportHeroesGroup's preset
  3. commits package.json (et al.) and CHANGELOG.md
  4. tags a new release

Installation

As npm run script

Install and add to devDependencies:

npm i --save-dev standard-version

Add an npm run script to your package.json:

{
  "scripts": {
    "release": "standard-version"
  }
}

Now you can use npm run release in place of npm version.

This has the benefit of making your repo/package more portable, so that other developers can cut releases without having to globally install standard-version on their machine.

As global bin

Install globally (add to your PATH):

npm i -g standard-version

Now you can use standard-version in place of npm version.

This has the benefit of allowing you to use standard-version on any repo/package without adding a dev dependency to each one.

CLI Usage

First Release

To generate your changelog for your first release, simply do:

# npm run script
npm run release -- --first-release
# or global bin
standard-version --first-release

This will tag a release without bumping the version in package.json (et al.).

When ready, push the git tag and npm publish your first release. \o/

Cut a Release

If you typically use npm version to cut a new release, do this instead:

# npm run script
npm run release
# or global bin
standard-version

As long as your git commit messages are conventional and accurate, you no longer need to specify the semver type - and you get CHANGELOG generation for free! \o/

After you cut a release, you can push the new git tag and npm publish (or npm publish --tag next) when you're ready.

Release as a pre-release

Use the flag --prerelease to generate pre-releases:

Suppose the last version of your code is 1.0.0, and your code to be committed has patched changes. Run:

# npm run script
npm run release -- --prerelease

you will get version 1.0.1-0.

If you want to name the pre-release, you specify the name via --prerelease <name>.

For example, suppose your pre-release should contain the alpha prefix:

# npm run script
npm run release -- --prerelease alpha

this will tag the version 1.0.1-alpha.0

Release as a target type imperatively like npm version

To forgo the automated version bump use --release-as with the argument major, minor or patch:

Suppose the last version of your code is 1.0.0, you've only landed fix: commits, but you would like your next release to be a minor. Simply do:

# npm run script
npm run release -- --release-as minor
# Or
npm run release -- --release-as 1.1.0

you will get version 1.1.0 rather than the auto generated version 1.0.1.

NOTE: you can combine --release-as and --prerelease to generate a release. This is useful when publishing experimental feature(s).

Prevent Git Hooks

If you use git hooks, like pre-commit, to test your code before committing, you can prevent hooks from being verified during the commit step by passing the --no-verify option:

# npm run script
npm run release -- --no-verify
# or global bin
standard-version --no-verify

Signing commits and tags

If you have your GPG key set up, add the --sign or -s flag to your standard-version command.

Lifecycle scripts

standard-version supports lifecycle scripts. These allow you to execute your own supplementary commands during the release. The following hooks are available and execute in the order documented:

  • prebump/postbump: executed before and after the version is bumped. If the prebump script returns a version #, it will be used rather than the version calculated by standard-version.
  • prechangelog/postchangelog: executes before and after the CHANGELOG is generated.
  • precommit/postcommit: called before and after the commit step.
  • pretag/posttag: called before and after the tagging step.

Simply add the following to your package.json to configure lifecycle scripts:

{
  "standard-version": {
    "scripts": {
      "prebump": "echo 9.9.9"
    }
  }
}

Skipping lifecycle steps

You can skip any of the lifecycle steps (bump, changelog, commit, tag), by adding the following to your package.json:

{
  "standard-version": {
    "skip": {
      "changelog": true
    }
  }
}

Committing generated artifacts in the release commit

If you want to commit generated artifacts in the release commit (e.g. #96), you can use the --commit-all or -a flag. You will need to stage the artifacts you want to commit, so your release command could look like this:

"prerelease": "webpack -p --bail",
"release": "git add <file(s) to commit> && standard-version -a"

Dry run mode

running standard-version with the flag --dry-run allows you to see what commands would be run, without committing to git or updating files.

# npm run script
npm run release -- --dry-run
# or global bin
standard-version --dry-run

CLI Help

# npm run script
npm run release -- --help
# or global bin
standard-version --help

Code usage

Use the silent option to stop standard-version from printing anything to the console.

var standardVersion = require('standard-version')

// Options are the same as command line, except camelCase
standardVersion({
  noVerify: true,
  infile: 'docs/CHANGELOG.md',
  silent: true
}, function (err) {
  if (err) {
    console.error(`standard-version failed with message: ${err.message}`)
  }
  // standard-version is done
})

Commit Message Convention, at a Glance

patches:

git commit -a -m "✴️ [FIX] (parsing) fixed a bug in our parser"

features:

git commit -a -m "✅ [ADD] (parser) we now have a parser \o/"

breaking changes:

git commit -a -m "✅ [ADD] (new-parser) introduces a new parsing library
BREAKING CHANGE: new library does not support foo-construct"

other changes:

You decide, e.g., docs, chore, etc.

git commit -a -m "☑️ [DOC] fixed up the docs a bit"
git commit -a -m "🔄 [MOD] (controllers) Changed implementation"
git commit -a -m "🔀 [TEST] (services) Adjusted MemoryRange unit tests"

but wait, there's more!

Github usernames (@bcoe) and issue references (#133) will be swapped out for the appropriate URLs in your CHANGELOG.

Badges!

Tell your users that you adhere to the Conventional Commits specification:

[![Conventional Commits](https://img.shields.io/badge/Conventional%20Commits-1.0.0-yellow.svg)](https://conventionalcommits.org)

changelog

Change Log

All notable changes to this project will be documented in this file. See standard-version for commit guidelines.

5.3.4 (2025-03-21)

  • 🔄 [MOD] Set config as peerDependencies (15ca992)

5.2.2 (2023-06-27)

🔄 Notable changes

  • Config: update branch rules for app releases (#10) (bd64987)), closes #10

5.2.1 (2021-07-28)

🔄 Notable changes

  • Miscellaneous: Bump bk-conventional-changelog (f8726ed))

5.2.0 (2020-03-24)

✅ Features

  • Miscellaneous: Skip changelog during prerelease (d3da294))

5.1.0 (2020-02-18)

⏩ Bump version

  • Security: Bump handlebars from 4.1.2 to 4.5.3 (fa5b5d6))
  • Security: Bump lodash.template from 4.4.0 to 4.5.0 (3634832))

✅ Features

  • Miscellaneous: Create prerelease from other branch (f7d79af))

5.0.3 (2019-09-05)

⏩ Bump version

  • Security: Bump lodash from 4.17.11 to 4.17.15 (0500050))
  • Security: Bump eslint-utils from 1.3.1 to 1.4.2 (11b2e7d))

🔄 Notable changes

  • Dependencies: Update packages dependencies (10a6bf8))
  • Dependencies: Upgrade dependencies (9d7523f))

5.0.1 (2019-06-06)

🔄 Notable changes

  • Miscellaneous: Bump bk-conventional-changelog (69467bd))

5.0.0 (2019-02-22)

☑️ Documentation

4.14.0 (2018-12-06)

✅ Features

4.13.0 (2018-07-09)

✅ Features

4.12.0 (2018-06-04)

✅ Features

🔄 Notable changes

4.11.0 (2018-05-23)

✅ Features

🔄 Notable changes

4.10.0 (2018-04-19)

✅ Features

4.9.0 (2018-02-12)

✅ Features

4.8.0 (2018-02-08)

✅ Features

4.7.0 (2018-02-02)

✅ Features

4.6.1 (2017-12-15)

🔄 Notable changes

4.6.0 (2017-11-22)

✅ Features

4.5.1 (2017-11-03)

🔄 Notable changes

4.5.0 (2017-10-31)

✅ Features

4.4.1 (2017-10-30)

🔄 Notable changes

4.4.0 (2017-10-26)

✅ Features

🔄 Notable changes

4.3.1 (2017-08-25)

🔄 Notable changes

4.3.0 (2017-08-16)

☑️ Documentation

✅ Features

🔄 Notable changes

4.2.0 (2017-06-12)

Features

4.1.0 (2017-06-06)

Features

  • cli: print error and don't run with node <4, closes #124 (d0d71a5)
  • add dry-run mode (#187) (d073353)
  • add prebump, postbump, precommit, lifecycle scripts (#186) (dfd1d12)
  • add support for npm-shrinkwrap.json (#185) (86af7fc)
  • add support for skipping lifecycle steps, polish lifecycle work (#188) (d31dcdb)
  • allow a version # to be provided for release-as, rather than just major, minor, patch. (13eb9cd)

4.0.0 (2016-12-02)

Bug Fixes

  • include merge commits in the changelog (#139) (b6e1562)
  • should print message before we bump version (2894bbc)
  • support a wording change made to git status in git v2.9.1 (#140) (80004ec)

Features

  • add support for bumping version # in bower.json (#148) (b788c5f)
  • make tag prefix configurable (#143) (70b20c8)
  • support releasing a custom version, including pre-releases (#129) (068008d)

BREAKING CHANGES

  • merge commits are now included in the CHANGELOG.

3.0.0 (2016-10-06)

Bug Fixes

  • check the private field in package.json(#102) (#103) (2ce4160)
  • err: don't fail on stderr output, but print the output to stderr (#110) (f7a4915), closes #91

Chores

  • package.json engines field >=4.0, drop Node 0.10 and 0.12 (28ff65a)

Features

  • options: add --silent flag and option for squelching output (2a3fa61)
  • added support for commitAll option in CLI (#121) (a903f4d)
  • separate cli and defaults from base functionality (34a6a4e)

BREAKING CHANGES

  • drop support for Node < 4.0 to enable usage of new tools and packages.

2.4.0 (2016-07-13)

Bug Fixes

  • index.js: use blue figures.info for last checkpoint (#64) (e600b42)

Features

  • changelogStream: use more default opts (#67) (3e0aa84)

2.3.1 (2016-06-15)

Bug Fixes

  • commit: fix windows by separating add and commit exec (#55) (f361c46), closes #55 #49

2.3.0 (2016-06-02)

Bug Fixes

  • append line feed to end of package.json (#42)(178e001)

Features

  • index.js: add checkpoint for publish script after tag successfully (#47)(e414ed7)
  • add a --no-verify option to prevent git hooks from being verified (#44)(026d844)

2.2.1 (2016-05-02)

Bug Fixes

  • upgrade to version of nyc that works with new shelljs(c7ac6e2)

2.2.0 (2016-05-01)

Bug Fixes

  • format the annotated tag message (#28)(8f02736)
  • upgraded dependencies, switched back to angular format (fixes #27), pinned shelljs to version that works with nyc (#30)(3f51e94)

Features

  • add --sign flag to sign git commit and tag (#29)(de758bc)

2.1.2 (2016-04-11)

Bug Fixes

2.1.1 (2016-04-10)

Bug Fixes

  • docs: had a bad URL in package.json, which was breaking all of our links (caa6359)

2.1.0 (2016-04-10)

Features

2.0.0 (2016-04-09)

  • feat(conventional-changelog-standard): Move to conventional-changelog-standard style. This style lifts the character limit on commit messages, and puts us in a position to make more opinionated decisions in the future. (c7ccadb)

BREAKING CHANGES

  • we no longer accept the preset configuration option.

1.1.0 (2016-04-08)

Features

  • cli: use conventional default commit message with version (9fadc5f)
  • rebrand: rebrand recommended-workflow to standard-version (#9) (1f673c0)
  • tests: adds test suite, fixed several Node 0.10 issues along the way (03bd86c)

1.0.0 (2016-04-04)

Features

  • initial-release: adds flag for generating CHANGELOG.md on the first release. (b812b44)