Lerna publish with no git commit, tag or push
To 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-push
, --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-push
and --no-git-tag
, come from the lerna version
command.
The lerna publish
docs mention that it supports all the options of lerna version
, “lerna publish supports all of the options provided by lerna version […]”.
However these version
options don’t doesn’t get printed in lerna publish --help
.
Next we’ll delve deeper into the options.
no-push
--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-push
to disable this behavior.
no-git-tag-version
By default, lerna version will commit changes to package.json files and tag the release. Pass
--no-git-tag-version
to disable the behavior.This option is analogous to the npm version option
--git-tag-version
, just inverted.
The name --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).
So --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.
Prior art
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)
Take your JavaScript testing to the next level by learning the ins and outs of Jest, the top JavaScript testing library.
orJoin 1000s of developers learning about Enterprise-grade Node.js & JavaScript