Skip to content

Nx plugin to automate semantic versioning and CHANGELOG generation.

License

Notifications You must be signed in to change notification settings

spotlesscoder/semver

Repository files navigation

@jscutlery/semver

Nx plugin for versioning using SemVer and CHANGELOG generation powered by Conventional Commits.

Setup

Install

Without Angular

npm install -D @jscutlery/semver
nx g @jscutlery/semver:install

or if you are using Angular:

ng add @jscutlery/semver

This package allows you to manage your monorepo using one of two modes: Synced or Independent.

Independent mode (default)

Allow multiple projects to be versioned independently. This way you release only what you want and consumers don't get updates they don't need. This allows small, rapid and incremental adoption of your packages.

Synced mode

Allow multiple projects to be versioned in a synced/locked mode. Use this if you want to automatically tie all package versions together.

One issue with this approach is that a major change in any project will result in all projects having a new major version.

This mode is useful when you are working with one product.

Usage

Release

Independent mode

Release project independently by running:

nx run my-project:version [...options]

You can leverage the built-in affected command to only version changed packages:

nx affected --target version [...options]

Synced mode

Release multiple projects at once:

nx run workspace:version [...options]

When run, this command does the following:

  1. Retrieve the current version(s) of affected package.json file(s).
  2. Bump the version based on your commits.
  3. Generates a changelog based on your commits (uses conventional-changelog-angular under the hood).
  4. Creates a new commit including your package.json file and updated CHANGELOG.
  5. Creates a new tag with the new version number.
  6. Push the release if enabled.

Available options:

name type default description
--dry-run boolean false run with dry mode
--no-verify boolean false skip git hooks
--first-release boolean false generate the CHANGELOG file
--push boolean false push the release
--origin string 'origin' push against git remote repository
--base-branch string 'main' push against git base branch
--sync-versions boolean false lock/sync versions between projects
--projects string[] [] version projects independently

Changelog

For new features or breaking changes see the changelog.

Contributors

This project follows the all-contributors specification.


Younes Jaaidi

🐛 💻 📖 💡 🤔

Edouard Bozon

🐛 💻 📖 💡 🤔

License

This project is MIT licensed.

About

Nx plugin to automate semantic versioning and CHANGELOG generation.

Resources

License

Contributing

Stars

Watchers

Forks

Packages

No packages published

Languages

  • TypeScript 99.5%
  • Other 0.5%