Semantic Versioning and Release Workflow
Use npm version commands to automate semantic versioning, generate git tags, and create a consistent release workflow for your packages.
Prerequisites
- -npm package with git initialized
- -Understanding of semantic versioning
Steps
Check the current version
View the current version of your package.
Bump a patch version
Increment the patch version for backward-compatible bug fixes.
npm version automatically updates package.json, creates a git commit, and tags it. The %s placeholder is replaced with the new version.
Bump a minor version
Increment the minor version for backward-compatible new features.
Bump a major version
Increment the major version for breaking changes.
Major version bumps signal breaking changes. Document all breaking changes in your changelog before releasing.
Create a prerelease version
Publish beta or RC versions for testing before stable release.
This creates versions like 1.0.1-beta.0, 1.0.1-beta.1. Publish with 'npm publish --tag beta' to avoid affecting the latest tag.
Publish with the correct dist-tag
Release the new version with the appropriate tag.
Full Script
FAQ
Discussion
Loading comments...