A command line node module to deal with "bumping" and "npm version"
The "version" command will:
- change the package version of the
package.json
file and in thepackage-lock.json
file if this one exists - update also the packages of your workspace and the inter-dependencies
- deal with the prenumber and the preid flag
- create git commits and tags
- push the git commits and tags
- No more pre/post npm run scripts
- No more json files modifications (except from NPM's ecosystem)
- Deal with NPM packages
- Split in packages
- @npmversion/cli: the new cli tool (we keep
npmversion
for posterity) - @npmversion/core: the core logic of the tool
- @npmversion/workspace: the tool logic to deal with npm packages, dependencies order, etc...
- @npmversion/cli: the new cli tool (we keep
--help
Print the help around the command
-i --increment [<level>]
Increment a version by the specified level. Level can
be one of: major, minor, patch, premajor, preminor,
prepatch, or prerelease. Default level is 'patch'.
Only one version may be specified. A Git commit and
tag will be created.
Nota Bene: it will use the "npm version" command if the option
"read-only" is not activated.
-p --preid <identifier>
Identifier to be used to prefix premajor, preminor,
prepatch or prerelease version increments. It could
be 'snapshot', 'beta' or 'alpha' for example.
--force-preid
If specified, we force to add if needed the specified preid
--read-only
Print only the future version. Don't modify the package.json file,
nor the npm-shrinkwrap.json file, don't create a commit and don't
create a git tag
--nogit-commit
No git commit
--nogit-tag
No git tag
--git-push
Push the commit and the tags if needed
-u --unpreid
Remove the prefix. The increment and preid option will be ignored.
Only a Git commit will be created
--read-only
Print only the future version. Don't modify the package.json file,
nor the npm-shrinkwrap.json file, don't create a commit and don't
create a git tag
--nogit-commit
No git commit
--nogit-tag
No git tag
--git-push
Push the commit and the tags if needed
Type the command "npm install --save-dev --save-exact npmversion
{
"name": "my-app",
"version": "1.2.0",
"devDependencies": {
"npmversion": "latest"
}
}
{
"name": "my-app",
"version": "0.0.1",
"scripts": {
"test": "node ./node_modules/mocha/bin/mocha --recursive --ui bdd --colors ./test",
"bump-release": "npm run test && npmversion --unpreid --git-push",
"bump-major": "npm run test && npmversion --increment major --git-push",
"bump-minor": "npm run test && npmversion --increment minor --git-push",
"bump-patch": "npm run test && npmversion --increment patch --git-push",
"bump-major-beta": "npmversion --increment major --preid beta --nogit-tag --git-push",
"bump-minor-beta": "npmversion --increment minor --preid beta --nogit-tag --git-push",
"bump-patch-beta": "npmversion --increment patch --preid beta --nogit-tag --git-push"
}
}
{
"force-preid": true,
"nogit-commit": false,
"nogit-tag": true,
"git-push": false,
"git-create-branch": false,
"git-branch-message": "release/%s",
"git-commit-message": "Release version: %s",
"git-tag-message": "v%s",
"increment": "minor",
"git-remote-name": null
}
> semver 1.2.3 --increment patch 1.2.4
> semver 1.2.3 --increment minor 1.3.0
> semver 1.2.3 --increment major 2.0.0
> semver 1.2.3 --increment prerelease 1.2.4-0
> semver 1.2.3 --increment prepatch 1.2.4-0
> semver 1.2.3 --increment preminor 1.3.0-0
> semver 1.2.3 --increment premajor 2.0.0-0
> semver 1.2.3-0 --increment patch 1.2.3
> semver 1.2.3-0 --increment minor 1.3.0
> semver 1.2.3-0 --increment major 2.0.0
> semver 1.2.3-0 --increment prerelease 1.2.3-1
> semver 1.2.3-0 --increment prepatch 1.2.4-0
> semver 1.2.3-0 --increment preminor 1.3.0-0
> semver 1.2.3-0 --increment premajor 2.0.0-0
> semver 1.2.3-beta --increment patch 1.2.4
> semver 1.2.3-beta --increment minor 1.3.0
> semver 1.2.3-beta --increment major 2.0.0
> semver 1.2.3-beta --increment prerelease 1.2.3-beta.0
> semver 1.2.3-beta --increment prepatch 1.2.4-0
> semver 1.2.3-beta --increment preminor 1.3.0-0
> semver 1.2.3-beta --increment premajor 2.0.0-0
> semver 1.2.3-beta.0 --increment patch 1.2.4
> semver 1.2.3-beta.0 --increment minor 1.3.0
> semver 1.2.3-beta.0 --increment major 2.0.0
> semver 1.2.3-beta.0 --increment prerelease 1.2.3-beta.1
> semver 1.2.3-beta.0 --increment prepatch 1.2.4-0
> semver 1.2.3-beta.0 --increment preminor 1.3.0-0
> semver 1.2.3-beta.0 --increment premajor 2.0.0-0
> semver 1.2.3 --preid beta --increment patch 1.2.4
> semver 1.2.3 --preid beta --increment minor 1.3.0
> semver 1.2.3 --preid beta --increment major 2.0.0
> semver 1.2.3 --preid beta --increment prerelease 1.2.4-beta.0
> semver 1.2.3 --preid beta --increment prepatch 1.2.4-beta.0
> semver 1.2.3 --preid beta --increment preminor 1.3.0-beta.0
> semver 1.2.3 --preid beta --increment premajor 2.0.0-beta.0
> semver 1.2.3-0 --preid beta --increment patch 1.2.4
> semver 1.2.3-0 --preid beta --increment minor 1.3.0
> semver 1.2.3-0 --preid beta --increment major 2.0.0
> semver 1.2.3-0 --preid beta --increment prerelease 1.2.3-beta.0
> semver 1.2.3-0 --preid beta --increment prepatch 1.2.4-beta.0
> semver 1.2.3-0 --preid beta --increment preminor 1.3.0-beta.0
> semver 1.2.3-0 --preid beta --increment premajor 2.0.0-beta.0
> semver 1.2.3-beta --preid beta --increment patch 1.2.4
> semver 1.2.3-beta --preid beta --increment minor 1.3.0
> semver 1.2.3-beta --preid beta --increment major 2.0.0
> semver 1.2.3-beta --preid beta --increment prerelease 1.2.3-beta.0
> semver 1.2.3-beta --preid beta --increment prepatch 1.2.4-beta.0
> semver 1.2.3-beta --preid beta --increment preminor 1.3.0-beta.0
> semver 1.2.3-beta --preid beta --increment premajor 2.0.0-beta.0
> semver 1.2.3-beta.0 --preid beta --increment patch 1.2.4
> semver 1.2.3-beta.0 --preid beta --increment minor 1.3.0
> semver 1.2.3-beta.0 --preid beta --increment major 2.0.0
> semver 1.2.3-beta.0 --preid beta --increment prerelease 1.2.3-beta.1
> semver 1.2.3-beta.0 --preid beta --increment prepatch 1.2.4-beta.0
> semver 1.2.3-beta.0 --preid beta --increment preminor 1.3.0-beta.0
> semver 1.2.3-beta.0 --preid beta --increment premajor 2.0.0-beta.0
> semver 1.2.3 --increment patch 1.2.4
> semver 1.2.3 --increment minor 1.3.0
> semver 1.2.3 --increment major 2.0.0
> semver 1.2.3 --increment prerelease 1.2.4-0
> semver 1.2.3 --increment prepatch 1.2.4-0
> semver 1.2.3 --increment preminor 1.3.0-0
> semver 1.2.3 --increment premajor 2.0.0-0
> semver 1.2.3-0 --increment patch 1.2.3
> semver 1.2.3-0 --increment minor 1.3.0
> semver 1.2.3-0 --increment major 2.0.0
> semver 1.2.3-0 --increment prerelease 1.2.3-1
> semver 1.2.3-0 --increment prepatch 1.2.4-0
> semver 1.2.3-0 --increment preminor 1.3.0-0
> semver 1.2.3-0 --increment premajor 2.0.0-0
> semver 1.2.3-beta --increment patch 1.2.4
> semver 1.2.3-beta --increment minor 1.3.0
> semver 1.2.3-beta --increment major 2.0.0
> semver 1.2.3-beta --increment prerelease 1.2.3-beta.0
> semver 1.2.3-beta --increment prepatch 1.2.4-0
> semver 1.2.3-beta --increment preminor 1.3.0-0
> semver 1.2.3-beta --increment premajor 2.0.0-0
> semver 1.2.3-beta.0 --increment patch 1.2.4
> semver 1.2.3-beta.0 --increment minor 1.3.0
> semver 1.2.3-beta.0 --increment major 2.0.0
> semver 1.2.3-beta.0 --increment prerelease 1.2.3-beta.1
> semver 1.2.3-beta.0 --increment prepatch 1.2.4-0
> semver 1.2.3-beta.0 --increment preminor 1.3.0-0
> semver 1.2.3-beta.0 --increment premajor 2.0.0-0
> semver 1.2.3 --preid beta --increment patch 1.2.4-beta
> semver 1.2.3 --preid beta --increment minor 1.3.0-beta
> semver 1.2.3 --preid beta --increment major 2.0.0-beta
> semver 1.2.3 --preid beta --increment prerelease 1.2.4-beta.0
> semver 1.2.3 --preid beta --increment prepatch 1.2.4-beta.0
> semver 1.2.3 --preid beta --increment preminor 1.3.0-beta.0
> semver 1.2.3 --preid beta --increment premajor 2.0.0-beta.0
> semver 1.2.3-0 --preid beta --increment patch 1.2.3-beta
> semver 1.2.3-0 --preid beta --increment minor 1.3.0-beta
> semver 1.2.3-0 --preid beta --increment major 2.0.0-beta
> semver 1.2.3-0 --preid beta --increment prerelease 1.2.3-beta.0
> semver 1.2.3-0 --preid beta --increment prepatch 1.2.4-beta.0
> semver 1.2.3-0 --preid beta --increment preminor 1.3.0-beta.0
> semver 1.2.3-0 --preid beta --increment premajor 2.0.0-beta.0
> semver 1.2.3-beta --preid beta --increment patch 1.2.4-beta
> semver 1.2.3-beta --preid beta --increment minor 1.3.0-beta
> semver 1.2.3-beta --preid beta --increment major 2.0.0-beta
> semver 1.2.3-beta --preid beta --increment prerelease 1.2.3-beta.0
> semver 1.2.3-beta --preid beta --increment prepatch 1.2.4-beta.0
> semver 1.2.3-beta --preid beta --increment preminor 1.3.0-beta.0
> semver 1.2.3-beta --preid beta --increment premajor 2.0.0-beta.0
> semver 1.2.3-beta.0 --preid beta --increment patch 1.2.4-beta
> semver 1.2.3-beta.0 --preid beta --increment minor 1.3.0-beta
> semver 1.2.3-beta.0 --preid beta --increment major 2.0.0-beta
> semver 1.2.3-beta.0 --preid beta --increment prerelease 1.2.3-beta.1
> semver 1.2.3-beta.0 --preid beta --increment prepatch 1.2.4-beta.0
> semver 1.2.3-beta.0 --preid beta --increment preminor 1.3.0-beta.0
> semver 1.2.3-beta.0 --preid beta --increment premajor 2.0.0-beta.0
npm run dev:check
: Run tests and styling over packagesnpm run dev:format
: Format files over packagesnpm run dev:format:check
: Check files format over packagesnpm run dev:linting
: Lint files over packagesnpm run dev:styling
: Format and lint files over packagesnpm run dev:publish
: Publish all the packages on npm registrynpm test
: Run tests over packagesnpm run test:coverage
: Run tests over packages and see coverage reports