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

support adding multiple packages in one command #1608

Closed
Janpot opened this issue Aug 27, 2018 · 5 comments · Fixed by #1612
Closed

support adding multiple packages in one command #1608

Janpot opened this issue Aug 27, 2018 · 5 comments · Fixed by #1612

Comments

@Janpot
Copy link
Contributor

Janpot commented Aug 27, 2018

npm install works for multiple packages as in

npm install package1 package2 package3

Trying something similar with lerna

lerna --scope=target-package package1 package2 package3

results in errors

Possible Solution

Allow to specify multiple packages to add at once. (a rm command would be usefull as well but that's a different issue I guess)

Context

I'm expecting (maybe wrong) a sort of duality between npm/yarncommands and lerna. I wasted a lot of time figuring out why lerna refused to execute my command. After that I wasted a lot of time adding these packages one by one.

Your Environment

Executable Version
lerna --version 3.1.4
npm --version 6.1.0
yarn --version 1.7.0
node --version v10.7.0
OS Version
macOS Sierra 10.13.6
@evocateur
Copy link
Member

In most cases, yes, we do try to match existing npm cli semantics. In this instance, the ambiguity of targets forced a simplification of logic.

Was lerna add --help not descriptive enough in its usage? How can we improve it?

@Janpot
Copy link
Contributor Author

Janpot commented Aug 28, 2018

The help is relatively clear. It's just that this command:

lerna add --scope=package3 package1 package2

returns

info cli using local version of lerna
lerna notice cli v3.1.4
lerna info filter [ 'package3' ]
lerna WARN No packages found where package1 can be added. 

Falsely assuming that add would add packages to the packages that are in --scope it seems to say "can't find package3" but actually it is saying "can't find package2". This completely threw me off and I went on trying to find issues in my project setup.

Then at some point I think I saw the help for add and tried

lerna add package1 package3

But it still returned the same error and that kind of confirmed my false assumption. In the end, just adding the packages one by one worked. After reading your comment I finally realise my stupidity:

lerna add package1 packages/package3

Which makes sense, but is a bit counterintuitive. as in "I want to add package1 to package3, but for the first I specify it by name, the second by folder".
The way to improve help would probably be by adding some examples of calling this command so it's clear the packages folder needs to be included. Maybe renaming glob to something like target would have helped as well.

@huafu
Copy link

huafu commented Oct 25, 2018

So at the end the real answer to this issue title is:

lerna does NOT support adding multiple packages to one or more scopes at once. If you want to install multiple packages, you need to run lerna add as many times as you have packages to install

right?

@Janpot
Copy link
Contributor Author

Janpot commented Oct 25, 2018

Seems like it, yes.

@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 a pull request may close this issue.

3 participants