Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(add): Add --exact option to lerna add #1478

Merged
merged 2 commits into from
Jul 16, 2018
Merged

feat(add): Add --exact option to lerna add #1478

merged 2 commits into from
Jul 16, 2018

Conversation

mcous
Copy link
Contributor

@mcous mcous commented Jun 19, 2018

Description

This PR adds an --exact flag to lerna add for installing dependencies at a fixed version, and it ensures that config.commands.add.exact is able to override the setting.

Motivation and Context

Both npm install and yarn add are able to install dependencies at a fixed version using --save-exact and --exact, respectively. lerna has an exact option available in init and publish, and some users expect that behavior to also exist in add.

Closes #1470

How Has This Been Tested?

I updated the unit tests to cover the new functionality. I also yarn linked lerna and tested on a local monorepo:

  • lerna add --exact to add new remote dependency
  • lerna add --exact to move ^ remote dependency to exact
  • lerna add with commands.add.exact in lerna.json set to true
  • lerna add with exact in lerna.json set to true
  • lerna add (with config in lerna.json) to add new local dependency
  • lerna add (with config in lerna.json) to move ^ local dependency to exact

Setup

  • macOS 10.13
  • Node v8.11.2
  • npm 6.1.0
  • yarn 1.7.0

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...

{
  pass: boolean,
  message: () => string
}

...and message for pass: true should be for the .not case. See jest docs.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

@mcous mcous changed the title Feat add exact feat(add): Add --exact option to lerna add Jun 19, 2018
@mcous
Copy link
Contributor Author

mcous commented Jul 6, 2018

@evocateur I noticed some activity on master over the last few days, so I wanted to ping you to see if a) you had any interest in merging this PR and b) if there's anything I can do in terms of fixing, rebasing, squashing, etc. to get this PR mergable for you.

From lurking in the issues you seem pretty busy, so no rush! I'm a fan (and user) of the project and was just hoping to help out 😄

@evocateur
Copy link
Member

@mcous Sorry for the delay, been really busy at work. I did some reorganizing that caused conflicts, so I'm gonna resolve those and merge this today. Thanks again for your patience!

mcous added 2 commits July 16, 2018 14:17
Corrects the return type of message from string to function, and fixes messages to be for the "not"
condition when pass: true
@evocateur
Copy link
Member

CI failures are unrelated, no worries.

@evocateur evocateur merged commit 346d156 into lerna:master Jul 16, 2018
@mcous mcous deleted the feat-add-exact branch July 16, 2018 23:43
@lock
Copy link

lock bot commented Dec 27, 2018

This thread has been automatically locked because there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Dec 27, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

"lerna add" still adds the version using a cart(^) even though I added exact into lerna.json
2 participants