Opinionated package versioner
This package can be used for versioning your Node.js projects. It uses Semantic Versioning and increments versions by specifying the desired release type.
node
v18 or higher
Add the module within your monorepo:
$ yarn add -D @uscreen.de/versionize
$ versionize latest // => increments (minor) pre-release version
$ versionize stable // => increments minor version
$ versionize hotfix // => increments patch version
$ versionize // => outputs current version
Versions are written into package.json
and manifest.json
. The package.json
always contains the current stable release version. The manifest.json
contains the current pre-release version, if given, otherwise also the current stable release version.
If you want to use versionize's output for shell scripts or similar, use the option --raw
. Instead of the default output, versionize will only write the new version to stdout, without any pretty printing.
If used with option --commit
, versionize will automatically commit the changes it made to package.json
and manifest.json
. If used with option --tag
, versionize will additionally tag the automatic commit with the new version.
You need a working git
binary in your PATH
.
The package also exposes some methods so you could use versionize
inside your project:
import { getCurrentVersion, bumpVersion } from '@uscreen.de/versionize'
Get the current version of your project:
const myVersion = getCurrentVersion()
You could overwrite the current working directory with the option cwd
:
const myVersion = getCurrentVersion({ cwd: '/path/to/my/project' })
Bump the version of your project:
bumpVersion('stable')
You could overwrite the current working directory with the option cwd
:
bumpVersion('stable', { cwd: '/path/to/my/project' })
To commit or tag the version bump, use the corresponding options:
// commit:
bumpVersion('stable', { commit: true })
// (commit &) tag:
bumpVersion('stable', { tag: true })
- TBD
Format according to https://keepachangelog.com
- fix api documentation in readme
- expose method to bump version
- node v16 support
- write newline to end of package file
- cli option to commit changes to git without tag
- cli option to commit changes to git and tag new commit
- cli option for raw output
- show current version when calling versionize without arguments
- give feedback about current version, too
- small ui changes
- refactoring
- give feedback about new version
- initial version with basic functionality
Licensed under MIT.
Published, Supported and Sponsored by u|screen