automatic-versioning v1.4.9
automatic-versioning
A script which will automatically increment your app package version in accordance with conventional commits
Why automatic-versioning
Most version bumping scripts only focus on just the version bumping. automatic-versioning takes into account your git changes and automatically increments the version number based on your last commit message only if there are changes in your directory, a feature which is highly useful in monorepos.
automatic-versioning by default, skips version bumping for special commits such as merge and revert commits.
Prerequisites
- Git installed and configured
Installation
# using npm
npm install automatic-versioning
# using yarn
yarn add automatic-versioning
Usage
- Add the following script to your package.json
"scripts": {
"bump-version": "yarn --cwd ./node_modules/automatic-versioning/ run bump-version --name=<package_name>"
}
- then:
# using npm
npm run bump-version
# using yarn
yarn bump-version
Usage with commitlint and husky
Install the following dependencies
"dependencies": {
"@commitlint/cli": "^17.0.1",
"@commitlint/config-conventional": "^17.0.0",
"husky": "^4.3.8"
}
Add the following to your package.json
"config": {
"commitizen": {
"path": "cz-conventional-changelog"
}
},
"husky": {
"hooks": {
"commit-msg": "commitlint -E HUSKY_GIT_PARAMS",
"post-commit": "HUSKY_SKIP_HOOKS=1 yarn bump-version",
}
},
"commitlint": {
"extends": [
"@commitlint/config-conventional"
]
}
Commit message prefixes and associated version bumping
- feat! - bump major version
- feat - bump minor version
- fix - bump patch version
Disable version bumping for specific commit
- Add the following to your commit message: "--no-bump"
// example command
git commit -m "feat: some feature --no-bump"
Disable --no-bump commit message edit
- By default automatic-versioning will edit the commit message in no-bump commits and remove the no-bump part from the commit message. Sometimes such as in the case of monorepos, this can prove to be a problem. To disable this behavior, add the following to your script: "--no-commit-edit"
// example script:
yarn --cwd ./node_modules/automatic-versioning/ run bump-version --name=<package_name> --no-commit-edit
Custom app directory to run incrementing script
- Add the following argument to your bump script: "--rootDir=<custom_dir>"
// example script:
yarn --cwd ./node_modules/automatic-versioning/ run bump-version --name=<package_name> --rootDir=<custom_dir>
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago