Commit and release manager
npm install @domestika/mono> Simple CLI for monorepo/multipackage.
mono is a tool that aims to simplify management for monorepo/multipackage projects but _it also works with monopackage projects_.
mono provides:
- Commit template → mono commit
- Release manager (parses commits to publish packages according to their changes) → mono check, mono release
- Run commands inside each package → mono run npm install, mono run-parallel npm install
We use:
- ComVer as our versioning system
- Commit Message Conventions as our standard for commit messages
mono provides, among other things, a standard template for commit messages (mono commit) and is able to decide what needs to be released for you (mono check & mono release).

- mono
- Installation
- Usage
- run command on all packages
- phoenix
- commit
- commit-all commit for all contained packages
- check & release
- How to configure your project
- private
- access
- Scope (packagesFolder, deepLevel, customScopes)
- Examples
- Project Example
- Case studio
- Manual scopes
``bash`
$ npm install @domestika/mono --save-dev
You can run a single command on each package of the monorepo (each subfolder with its own package.json), in series
`sh`
$ mono run
$ mono run npx rimraf node_modules
$ mono run npm install
You can also run them in parallel
`sh`
$ mono run-parallel
$ mono run-parallel npx rimraf node_modules
$ mono run-parallel npm install
To reset your project and all its contained packages.
`sh`
mono phoenix
Equivalent to npx rimraf node_modules && npm i but it works on any environment and mono phoenix executes it concurrently on each package (and/or on your project root folder).
By default commands will be executed on chunks of 20 packages, but you can change it with -c, --chunk option:
`sh`
mono phoenix -c 5
So, if executing many commands as the same time in your machine is too heavy, you can adjust it.
You can also disable the chunks with 0 value and always execute all commands in parallel:
`sh`
mono phoenix -c 0
If you don't want a fancy progress output (for instance in CI env), you can force a plain text output:
`sh`
mono phoenix --no-progress
Reinstalls all scope packages but ignores the node_modules folder and package-lock.json file at the root level of your project
`sh`
mono phoenix --no-root
Ables you to just reinstall the dependencies from a single scope
`sh`
mono phoenix --no-root --scope atom/button
You do your normal git workflow, but when commiting you should use:
`sh`
mono commit
It will prompt you with questions regarding your changes and will generate a standard commit message for you
You can commit the same message for all packages that actually contained stageable
files.
`sh`
mono commit-all -t "feat" -m "Refactor of dependencies"
The precommit will be executed only for the first commit.
In order to release the steps are:
Preview what will be released
`sh`
mono check
Release all the packages
`sh`
mono release
In case you want to release a single package use the --scope param
`sh`
mono release --scope "packages/test"
> Your packages must implement script npm run build or npm run prepublish that will be executed before any release.
> 👉 mono creates a new MINOR version for the package only when fix, perf or feat commits are detected, and a new MAJOR version if there is some commit marked as BREAKING CHANGES. Otherwise (any other types of commits detected), no new version will be generated and nothing will be released
Automatic release (only CI)
In case you want to release via CI the --github-user --github-email and --github-token must be passed by like follows:
`sh`
mono release --github-user [username] --github-email [user email] --github-token [TOKEN]
First you need to install the @domestika/mono package in your project
`sh`
npm i --save-dev @domestika/mono
Then, you can configure your package.json to suit your needs
mono allows you to configure some parts of its functioning, but it also defines a few defaults for convenience.
Here'domestikafull example of the options
`json`
"private": true,
"config": {
"mono": {
"access": "public",
"packagesFolder": "test/components",
"deepLevel": 2,
"customScopes": [
"cz-config",
"check",
"release"
]
},
"validate-commit-msg": {
"types": "@domestika/mono/src/types"
},
}
If you specify that your package is private ("private": true,), it will not get pushed to npm repository
By default packages will be published as restricted in npm. If you want them to be public you will need to set "access": "public"
> 👉 Setting the proper scope in the commit message is important, because this is used for mono check and mono release to assign changes to specific packages and release them to the proper packages
We provide a simple tool to automate the way the scopes are retrieved.
If you follow a structure where do you have:
- a main folder and
- inside this folder you have all the packages (subfolders, each one of them with its own package.json → _scopes_)
...this configuration will work for you
In order to specify the main folder you need to provide packagesFolder by default its value is srcdeepLevel
By default we check only 1 level inside the main folder, but if you have categories for each package and inside the packages you can configure
This information will be used for releases and commitizen scopes.
#### Examples
###### Project Example
So, if you have a project like this:
`text`
src/
i18n/
users/
search/
...
The default options will give you a list of scopes like this one for your commit:
`text`
i18n
users
search
###### Case studio
In the case of studio, which generates a folder like this one:
`text`
components/
ads/
big/
small/
card/
featured/
normal/
If you set the configuration of your project like this:
`json`
"packagesFolder": "components"
"deepLevel": 2
You will have a list of scopes like this one when performing a commit:
`text`
ads/big
ads/small
card/featured
card/normal
#### Manual scopes
There may be cases that you may want to add scopes for informative purposes but not related in any way with the releases
Take in care that this scopes will not be relevant for the release, and if you commit to one package that has his own scope, but you use a custom scope, a release will not be generated.
Custom scopes are for a very rare cases and you may not need it most of the times.
Use customScopes` in this cases like in the example. The scopes will be added to the automatically generated ones.