The easiest way to publish packages for projects using Lerna and NPM.
When publishing packages, it is necessary to follow the correct sequence of updates.
For example, we have three packages: A, B, C. B depends on A. C depends on B.
If we want to update A, we need to update B and C (A -> B -> C).
We can specify versions of dependencies flexibly, but this does not help in the case of publishing an unstable version of a package (with next
tag, for example). Adding more packages will only make the problem of queuing worse.
Publish Wizard helps you not to think about the problem of queuing, allowing you to focus on what's important.
demonstration.mp4
- Select a package from the list
- Select the action:
- Publish a prerelease
- Publish a release (soon)
- Show the update queue
- Select a tag from the list
- Select the extent of changes
- Accept publish
Publish Wizard will repeat the cycle of questions for all the packages that need to be updated.
It will result in a queue of packages that have been published.
Output example
Published packages:
1. my-awesome-package@1.0.0-next.3
2. kitty@3.0.2-alpha.0
3. mushroom@7.1.3-nightly.4
Soon...
Publish Wizard will display the queue of packages that need to be updated.
Output example
Bump packages in order:
1. my-awesome-package
2. kitty
3. mushroom
5. sandbox
- Make sure that the project uses Lerna and NPM
- Make sure that the prepublishOnly script is present in the packages:
{
"name": "my-awesome-package",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"prepublishOnly": "<do-smth-before-publish>"
}
}
- Install
@space307/publish-wizard
:
npm install --save-dev @space307/publish-wizard
# or
yarn add @space307/publish-wizard --dev
- Add the
publish-wizard
script to your root package.json:
{
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
+ "publish-wizard": "publish-wizard"
}
}
- Run Publish Wizard:
npm run publish-wizard
# or
yarn run publish-wizard
You can specify custom postfixes
and publish command
through the config.
Publish Wizard supports three ways to define config.
publish-wizard
section inpackage.json
:
"publish-wizard": {
"postfixes": ["my", "awesome", "postfixes"],
"publishCommand": "run my-awesome-command"
}
- or a separate
.publish-wizard.json
config file:
{
"postfixes": ["my", "awesome", "postfixes"],
"publishCommand": "run my-awesome-command"
}
Options description:
-
postfixes: list of postfixes that will be added to the standard list.
-
publishCommand: the command that will be called to publish.
publish
by default.
All options are optional.