README
Version Butler
Auto update version strings in files from your changelog with a pre-commit hook
- 👨🔧 Manage multiple packages within a monorepo
- 👨💻 Provide config for any file and string pattern to update
- 🙌 Setup pre-commit hook via CLI
- 🥳 Enjoy current version files with every commit
Getting Started
Install Version Butler
$ yarn add version-butler -D
# or
$ npm install --save-dev version-butler
Usage
Install Version Butler as pre-commit hook (overwrites existing pre-commit hook).
$ yarn ver install
Uninstall Version Butler (deletes existing pre-commit hook).
$ yarn ver uninstall
Provide a configuration file like the one bwlow. Add as many packages, as you like. Providing a changelog for each package conforming to keep a changelog is mandatory. Versions must read with patterns like [1.0.0]
.
module.exports = {
packages: [
{
root: "./source/client/core",
changelog: "./source/client/core/documentation/changelog.md",
files: [{ name: "package.json" }],
},
{
root: "./source/client/mobile",
changelog: "./source/client/mobile/documentation/changelog.md",
files: [
{ name: "package.json" },
{ name: "project.pbxproj", start: "MARKETING_VERSION = ", end: ";" },
{
name: "build.gradle",
start: "versionCode ",
end: "\n",
integer: true,
},
{ name: "build.gradle", start: 'versionName "', end: '"' },
],
},
{
root: "./source/client/web",
changelog: "./source/client/web/documentation/changelog.md",
files: [{ name: "package.json" }],
},
{
root: "./source/server",
changelog: "./source/server/documentation/changelog.md",
files: [{ name: "package.json" }],
},
],
};
Add a script to your root package.json
...
scripts: {
...
"ver": "ver"
}
...
ALternatively use manually from command line with ver
without installing the pre-commit hook.