Packages Publisher
Tool to help publishing packages within a repository, using the same version for all packages.
Quick start
You can install it globally to use across projects:
npm install -g @clabs/packages-publisher
You can check it has been installed by running:
packages-publisher --help
or the short version:
pkgs --help
Usage
Running the tool
This tool should be ran from the root of the monorepo for multiple packages. It can also be ran from within a single package. It can either be ran directly or added to your npm scripts.
Note that if you are using yarn
you might need to add a .yarnrc
with npm's registry so that it can find the right information when publishing. See this package's .yarnrc
for an example.
Configuration
You need to indicate what's the path where packages can be found.
For that, you can add a configuration to the package.json at the root of your monorepo.
{
[...]
"pkgs": {
"path": "./packages"
}
[...]
}
Alternatively, if path is not configured there, you can pass it as a flag to the commands.
Commands
At any point, you can run pkgs [command] --help
to learn more about a command.
Bump Versions
This bumps all packages in the given path and where they are used as dependencies as well.
Example:
pkgs bump-versions minor --path packages
Publish
Builds and publishes all packages in the given path to npm.
You can skip build if you have a monorepo build type.
Example:
pkgs publish --path packages [--otp 123456] [--skip-build]
Development