Lerna version 3 is now out of beta! Under the hood there have been a fair few changes, but it is backwards-compatible so that you can upgrade at your convenience. Here are some of the important deprecations that I have found through upgrading my build scripts:
lerna publish --skip-npm is now deprecated. Use
lerna version instead.
lerna publish only handles publishing to an npm repository itself. It calls through to
lerna version in order to handle the package.json version bumps and the git tagging, so if you don’t need to publish to an npm repository, call the
version command directly yourself. For backwards-compatibility and practical reasons, flags passed to
lerna publish that are recognised by
lerna version are passed through as expected.
lerna publish --skip-git is now deprecated. Use
lerna version --no-git-tag-version --no-push (or
lerna publish --no-git-tag-version --no-oush) instead.
I’ve used this flag to the
lerna publish command many times while debugging CI scripts, just so that I don’t have to manually unwind the changes in git. As described above, now that the version bumping is handled by
--skip-git is still supported on that command although marked as deprecated.
You can run with the
--no-git-tag-version flag to prevent a git commit and a git tag from occurring during the version bump. Adding
--no-push prevents a push of these changes to a git remote, if one is configured.
–cd-version and –repo-version
lerna publish --cd-version=patch and
lerna publish --repo-version 1.0.1 are both deprecated. Run
lerna version <version-number> (or
lerna publish <version-number>) with either the exact version number, or a semver keyword such as major/minor/patch.
A great simplification of the CLI - I never fully understood why these were separate flags!
lerna ls is now
lerna list, although
lerna ls is still supported. Additionally you can run
lerna ll as shorthand for
lerna list -l and
lerna la as shorthand for
lerna list -la. Longform versions
--all are also supported. Additionally, you can retrieve the output as parseable JSON with the
--json flag - ideal for running build scripts!
Remember that you don’t have to do anything immediately because all existing commands are still supported. Lerna will print deprecation warnings to the console with the suggested changes that you can make to your build scripts.