monorepo-pm v1.0.0-alpha.3
Monorepo (sub)Project Manager
A simple CLI to help you manage your Monorepo.
Quick Start
$ npm install --global monorepo-pm
$ monopm help
Usage: monopm [options] [command]
Monorepo (sub)Project Manager
Options:
--debug show debug messages
--force force dangerous operations (use with caution)
--commit commit everything (even when not absolutely necessary)
-h, --help output usage information
Commands:
add [options] <path> [url] add, convert or import a project to the monorepo
check [options] <directory> check if <directory> has changed since the last release
update <directory> [url] update the remote "subtree" repo associated to <directory>
mv <path> <newPath> change a subtree prefixPrinciples
monopm aim to be as generic, light, efficient and simple as possible.
- No need to reinvent the wheel:
monopmuse git branches and subtrees. That it! - Keep your freedom:
monopmhelps you to better use git, but you can continue to use git as you're used to - Good monorepos needs good commits:
monopmhelps you follow the conventional commits conventions and good practices in general
Commands
All commands must be executed from your monorepo. If you run it from a sub-directory of this monorepo, make sure to give a path that is absolute or relative to your current working directory.
:warning: Monopm steps through the parents of your current working directory to find the
monorepo-spm.jsonconfiguration file and will consider its parent directory as the root of your monorepo.If you have not yet added this file, it will consider the first git repository it finds (i.e. the first directory containing a
.gitfolder) as a monorepo. Therefore, you will not be able to execute a command from a git submodule until you have generated or written a Monopm configuration file.
Add
$ monopm add --help
Usage: monopm add <path> [url] [options]
add, convert or import a project to the monorepo
<path> path to the project directory
[url] subrepo origin url (default: submodule url or none)
Behavior depends on what the <path> directory contains and if you provided an [url] or not:
1. if <path> is a submodule, it will be converted to a "subproject"
2. if [url] is provided, the associated repository will be imported to the monorepo (overriding the submodule url)
3. the project's data will be added to the configuration
Options:
--name <name> define project name and scope (default: submobule or directory name)
--no-amend do not amend commits for correction after automatic rewording
-h, --help output usage informationExamples
Convert the submodule in packages/foo, without editing commits messages after the automatic rewording, and using the url and name defined in .gitmodules:
monopm add packages/foo --no-amendAdd github.com:username/my-project into the projects/web/my-project directory, and record it under the name www (see configuration for more details).
monopm add projects/web/my-project git@github.com:username/my-project.git --name="www"Configuration
After adding your first subproject, a monorepo-pm.json file will be automatically created into your monorepo root directory.
{
"projects" : [
{
"name": "www",
"url": "git@github.com:username/my-project.git",
"directory": "projects/web/my-project"
},
{
"name": "cmd",
"url": "git@github.com:username/my-cmd-project.git",
"directory": "scripts/cmd"
}
]
}Some commands will use this file in order to make your life easier.