What is standard-version?
The standard-version npm package is a utility for versioning and changelog generation based on conventional commits. It automates the process of updating the version number in your package.json file, generating a changelog, and creating a new Git tag.
What are standard-version's main functionalities?
Version Bumping
This command will bump the version in your package.json file based on the conventional commits in your repository. It will also create a new Git tag for the release.
npx standard-version
Changelog Generation
This command will generate a changelog based on the conventional commits and bump the version as a minor release. The changelog will be updated with the new changes.
npx standard-version --release-as minor
Pre-release Versioning
This command will bump the version to a pre-release version (e.g., 1.0.0-beta.0) and update the changelog accordingly.
npx standard-version --prerelease beta
Custom Release Types
This command allows you to specify a custom version number for the release, overriding the automatic version bump based on conventional commits.
npx standard-version --release-as 1.1.0
Other packages similar to standard-version
semantic-release
semantic-release automates the whole package release workflow including: determining the next version number, generating the release notes, and publishing the package. It is more comprehensive than standard-version and integrates with CI/CD pipelines for fully automated releases.
release-it
release-it is a versatile release tool for versioning, changelog generation, and publishing. It is highly configurable and can be extended with plugins. Compared to standard-version, release-it offers more flexibility and customization options.
lerna
lerna is a tool for managing JavaScript projects with multiple packages. It can also handle versioning and changelog generation for monorepos. While it offers similar functionalities to standard-version, lerna is specifically designed for managing multi-package repositories.
Standard Version
stop using npm version
, use standard-version
it rocks!
Automatic release and CHANGELOG management, using GitHub's new squash button and
the workflow outlined in conventional-changelog-standard.
how it works:
- when you land commits on your
master
branch, select the Squash and Merge option. - add a title and body that follows the conventional-changelog-standard conventions.
- when you're ready to release to npm:
- checkout
master
. - run
standard-version
. git push --tags; git push origin master; npm publish
.
standard-version
does the following:
- bumps the version in package.json (based on your commit history).
- uses conventional-changelog to update CHANGELOG.md.
- commits package.json and CHANGELOG.md.
- tags a new release.
Initial CHANGELOG.md Generation
When you're generating your changelog for the first time, simply do:
standard-version --first-release
Installation
npm i standard-version -g
Or, add it as a development dependency like so:
npm i standard-version --save-dev
_And add this to your package.json:
{
"scripts": {
"release": "standard-version"
}
}
Commit Message Convention, at a Glance
patches:
-m "fix(parsing): fixed a bug in our parser"
features:
git commit -a -m "feat(parser): we now have a parser \o/"
breaking changes:
git commit -a -m "feat(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 "docs: fixed up the docs a bit"
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 standard-version
commit guidelines:
[![Standard Version](https://img.shields.io/badge/release-standard%20version-brightgreen.svg)](https://github.com/conventional-changelog/standard-version)
License
ISC