A tiny monorepo release tool.
- β‘οΈ Select a package to operate
- π€ Automatic version derivation
- π Semantic version by semver
- β Configure via file or command line
- π Branch protection
- π Rollback protection
- π Changelog by conventional-changelog-cli
- π¦ Unlimited package manager
- π’ Also contains a publish command
npm i mono-release -D
# Or Yarn
yarn add mono-release -D
# Or PNPM
pnpm add mono-release -D
Note: You may need to add
-W
flag to install it in a monorepo workspace.
Use directly:
npx mono-release
# Or
npx mor
Or through a script in package.json
:
{
"scripts": {
"release": "mono-release"
}
}
It also provides a command for publishing packages:
npx mono-release publish bar@0.0.1
The tag format must be: <pkg>@<version>
.
You can add a "mono-release" key to package.json
to add configuration for it:
{
"mono-release": {
"packagesPath": "packages-path",
"exclude": ["pkg-will-not-be-released"],
"changelog": true,
"dry": false,
"push": true
}
}
mono-release.config.ts
('.js' | '.cjs' | '.mjs' | '.json'
) is also available:
import { defineConfig } from 'mono-release'
export default defineConfig({
packagesPath: 'packages-path',
exclude: ['pkg-will-not-be-released'],
changelog: true,
dry: false,
push: true
})
mono-release --config mono-release.config.ts
Use specified config file.
mono-release --specified-package pkg-name
Specified package which will be released, skip selector, ignore exclude
.
mono-release --changelog
# Or disabled
mono-release --no-changelog
Whether to generate changelog.
Note: You need to install conventional-changelog-cli to generate changelog.
mono-release --include pkg1,pkg2,pkg3
Include packages, if specified, this tool will only work on specified packages, exclude
will override include
.
mono-release --exclude pkg1,pkg2,pkg3
Excludes specified packages (These packages will not appear in the list of options).
mono-release --dry
Dry run. (default: false
)
mono-release --disable-push
# Or disabled
mono-release --no-push
By default, this tool will push commit and tag to remote, use this option to disable it. (default: false
)
mono-release --commit-check
# Or disabled
mono-release --no-commit-check
Whether to check commit before release. (default: true
)
Warning: If disabled, you may lose all uncommited changes when rollback.
mono-release --version-type alpha-minor
Default version type, if you specify it, will skip version select action. (default: undefined
)
Available values: next
, alpha-minor
, alpha-major
, beta-minor
, beta-major
, minor
, major
.
mono-release --ci
Run in CI mode, will skip all select actions, you must specify --specified-package
.
mono-release --ci --ci-msg-suffix "[skip ci]"
Specify commit message suffix in CI mode, example: [skip ci]
.
mono-release --before-release "npm run test"
You can specify command to be executed before release.
mono-release publish --use pnpm
Use specified package manager for publishing. (default: npm
)
Note: Some packages may depend on other packages under the same monorepo, and publishing with a specific package manager can handle these relationships automatically. (eg, pnpm workspace protocol)
mono-release publish --before-publish "npm run test"
You can specify command to be executed before publish.
Note: The default cwd is the package directory when running before publish command
mono-release --help
Print help information.
mono-release --version
Print the version.
When you need release a package from monorepo project, you can run this tool to execute a command-line script, which you can select the package that needs to release and select a recommended version. It will automatically generate a commit message about this release, and push this commit. In addition, a tag about this version will also be pushed.
Much of the code for this tool references Vite's release scripts. You can observe the details of its release to understand more how it works
MIT License Β© 2022 Archer Gu