feat(add): Add --exact
option to lerna add
#1478
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This PR adds an
--exact
flag tolerna add
for installing dependencies at a fixed version, and it ensures thatconfig.commands.add.exact
is able to override the setting.Motivation and Context
Both
npm install
andyarn add
are able to install dependencies at a fixed version using--save-exact
and--exact
, respectively.lerna
has anexact
option available ininit
andpublish
, and some users expect that behavior to also exist inadd
.Closes #1470
How Has This Been Tested?
I updated the unit tests to cover the new functionality. I also
yarn link
ed lerna and tested on a local monorepo:lerna add --exact
to add new remote dependencylerna add --exact
to move^
remote dependency to exactlerna add
withcommands.add.exact
inlerna.json
set to truelerna add
withexact
inlerna.json
set to truelerna add
(with config in lerna.json) to add new local dependencylerna add
(with config in lerna.json) to move^
local dependency to exactSetup
During the course of updating the unit tests, I noticed that the
pkg-matchers
extend
matchers were not actually returning the correct objects, so I fixed those up as well. The object returned should be......and
message
forpass: true
should be for the.not
case. See jest docs.Types of changes
Checklist: