commit-and-tag-versionis a fork ofstandard-version. Because of maintainer availability,standard-versionwas deprecated on 15th May 2022. The previous maintainer recommends release-please as an alternative for those who are using GitHub actions. This fork exists for those who can't switch torelease-please, or who would like to continue usingstandard-version.
Can I simply swap the library to migrate?To migrate, you can drop incommit-and-tag-versionin place ofstandard-version. There are no changes in 9.5.0, other than to add the package.json config keycommit-and-tag-version(the previous configuration keystandard-versionwill still work). 10.x drops support for deprecated node versions, 11.x is a formatting change if you're relying on the exact markdown format in the changelog, and 12.x drops support for node 14/16.
Why was it renamed commit-and-tag-version?. I didn't want to scope the package or name itstandard-version-fork, and it was a good opportunity to make the purpose of the tool clearer. I also wanted to distinguish it from the other tool in this organisation,absolute-version, which just prints version information for pre-releases.
A utility for versioning using semver and CHANGELOG generation powered by Conventional Commits.
Having problems? Want to contribute? Join us on the node-tooling community Slack.
commit-and-tag-version
npm version-like)commit-and-tag-version.commit-and-tag-version will then do the following:
packageFiles[1], falling back to the last git tag.bump the version in bumpFiles[1] based on your commits.changelog based on your commits (uses conventional-changelog under the hood).commit including your bumpFiles[1] and updated CHANGELOG.tag with the new version number.bumpFiles, packageFiles and updaterscommit-and-tag-version uses a few key concepts for handling version bumping in your project.
packageFiles – User-defined files where versions can be read from and be "bumped".package.json, manifest.jsonpackageFiles are a subset of bumpFiles.bumpFiles – User-defined files where versions should be "bumped", but not explicitly read from.package-lock.json, npm-shrinkwrap.jsonupdaters – Simple modules used for reading packageFiles and writing to bumpFiles.By default, commit-and-tag-version assumes you're working in a NodeJS based project... because of this, for the majority of projects you might never need to interact with these options.
That said, if you find your self asking How can I use commit-and-tag-version for additional metadata files, languages or version files? – these configuration options will help!
If you are using Maven, then just point to your pom.xml file.
commit-and-tag-version --packageFiles pom.xml --bumpFiles pom.xml
If you are using Gradle, then just point to your build.gradle file (or build.gradle.kts if using Kotlin DSL).
commit-and-tag-version --packageFiles build.gradle --bumpFiles build.gradle
If you are using .NET with .csproj files.
This is going to read and update only the <Version> tag in the file.
commit-and-tag-version --packageFiles <YOUR-PROJECT-NAME>.csproj --bumpFiles <YOUR-PROJECT-NAME>.csproj
If you are using YAML files.
This is going to read and update only the version: tag in the file.
commit-and-tag-version --packageFiles file.yaml --bumpFiles file.yaml
If you are using OpenAPI, then just point to your openapi.yaml file.
commit-and-tag-version --packageFiles openapi.yaml --bumpFiles openapi.yaml
If you are using Python with Poetry, then point to your pyproject.toml file.
commit-and-tag-version --packageFiles pyproject.toml --bumpFiles pyproject.toml
commit-and-tag-versionnpm run scriptInstall and add to devDependencies:
npm i --save-dev commit-and-tag-version
Add an npm run script to your package.json:
{
"scripts": {
"release": "commit-and-tag-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 commit-and-tag-version on their machine.
binInstall globally (add to your PATH):
npm i -g commit-and-tag-version
Now you can use commit-and-tag-version in place of npm version.
This has the benefit of allowing you to use commit-and-tag-version on any repo/package without adding a dev dependency to each one.
npxAs of npm@5.2.0, npx is installed alongside npm. Using npx you can use commit-and-tag-version without having to keep a package.json file by running: npx commit-and-tag-version.
This method is especially useful when using commit-and-tag-version in non-JavaScript projects.
You can configure commit-and-tag-version either by:
commit-and-tag-version stanza in your package.json (assuming
your project is JavaScript).Note for users who have migrated to
commit-and-tag-versionfromstandard-version: the previous package.json configuration key ofstandard-versionwill still work.
Creating a .versionrc, .versionrc.json or .versionrc.js.
If you are using a .versionrc.js your default export must be a configuration object, or a function returning a configuration object.
Any of the command line parameters accepted by commit-and-tag-version can instead
be provided via configuration. Please refer to the conventional-changelog-config-spec for details on available configuration options.
By default, commit-and-tag-version uses the conventionalcommits preset.
This preset adheres closely to the conventionalcommits.org specification.
Suppose you're using GitLab, rather than GitHub, you might modify the following variables:
commitUrlFormat: the URL format of commit SHAs detected in commit messages.compareUrlFormat: the URL format used to compare two tags.issueUrlFormat: the URL format used to link to issues.Making these URLs match GitLab's format, rather than GitHub's.
You can override both parser and writer options (they will be merged into the preset we just mentioned). As an example, to list commits in the order that they were committed:
{
"commit-and-tag-version": {
"writerOpts": {
"commitsSort": false
}
}
}
NOTE: To pass nested configurations to the CLI without defining them in the
package.jsonuse dot notation as the parameterse.g. --skip.changelog.
To generate your changelog for your first release, simply do:
# npm run script
npm run release -- --first-release
# global bin
commit-and-tag-version --first-release
# npx
npx commit-and-tag-version --first-release
This will tag a release without bumping the version bumpFiles1.
When you are ready, push the git tag and npm publish your first release. \o/
If you typically use npm version to cut a new release, do this instead:
# npm run script
npm run release
# or global bin
commit-and-tag-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.
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
This will tag your version as: 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 as: 1.0.1-alpha.0
When cutting a prerelease with --prerelease, commit-and-tag-version automatically checks existing git tags (respecting your tagPrefix configuration) for the same base version and prerelease channel. If a tag already exists, the numeric suffix is automatically incremented to avoid conflicts.
For example, if you're working with multiple prerelease channels simultaneously:
commit-and-tag-version --prerelease xyz # Creates v1.4.3-xyz.0
commit-and-tag-version --prerelease abc # Creates v1.4.3-abc.0
commit-and-tag-version --prerelease xyz # Creates v1.4.3-xyz.1 (auto-incremented)
This behavior applies to both named prereleases (e.g., -alpha.0, -beta.1) and unnamed prereleases (e.g., -0, -1), ensuring that you can safely cut multiple prerelease versions without encountering git tag conflicts.
npm version-like)To forgo the automated version bump use --release-as with the argument major, minor or patch.
Suppose the last version of
$ claude mcp add commit-and-tag-version \
-- python -m otcore.mcp_server <graph>