lerna publish without a git commit or attempting to git push, use
--no-push --no-git-tag-version, like so:
lerna publish --no-push --no-git-tag-version
For official documentation on these options see the
lerna version docs.
To understand the specifics of
--no-git-tag and why these options are documented in
lerna version, read on.
Table of Contents
Why are we using
lerna version options?
The 2 options we’re passing:
--no-git-tag, come from the
lerna version command.
lerna publish docs mention that it supports all the options of
lerna version, “lerna publish supports all of the options provided by lerna version […]”.
version options don’t doesn’t get printed in
lerna publish --help.
Next we’ll delve deeper into the options.
--no-push is quite self-explanatory from the
lerna version docs:
By default, lerna version will push the committed and tagged changes to the configured git remote. Pass
--no-pushto disable this behavior.
By default, lerna version will commit changes to package.json files and tag the release. Pass
--no-git-tag-versionto disable the behavior.
This option is analogous to the npm version option
--git-tag-version, just inverted.
--no-git-tag-version is somewhat misleading since it doesn’t mention git commits. Digging further, since the docs mention the npm config - git-tag-version, we can check how that works: “Tag the commit when using the npm version command. Setting this to false results in no commit being made at all.” (emphasis my own).
--no-git-tag-version does what we need, it stops both a git commit and git tag being generated, although the name is not intuitive.
There’s an existing post with the same approach as here: Lerna Publish to NPM Without a Git Commit.
I skimmed skim through it, but it didn’t make
lerna publish --no-push --no-git-tag-version click for me. It definitely does explain that
lerna publish --no-push --no-git-tag-version should be used though.
Get The Jest Handbook (100 pages)