lerna --scope does not support comma separated package names
See original GitHub issueCalling lerna add external-package-name --scope=internal-package-1,intenal-package-2 throws error
lerna notice cli v3.8.4
lerna info filter [ 'internal-package-1,internal-package-2 ]
lerna ERR! EFILTER No packages remain after filtering [ 'internal-package-1,internal-package-2' ]
Expected Behavior
Lerna should split the string after --scope= by a comma , and iterate resulting array.
Current Behavior
Here is a dump of stdout when trying to issue command line with multiple package names:
Tryout 1, resulting error
$ lerna add react --exact --scope=components,frontend-admin,frontend-public
info cli using local version of lerna
lerna notice cli v3.8.4
lerna info filter [ 'components,frontend-admin,frontend-public' ]
lerna ERR! EFILTER No packages remain after filtering [ 'components,frontend-admin,frontend-public' ]
✘-1 ~/workspace/s24 [master|●1✚ 5…2]
Tryout 2, resulting error
$ lerna add react --exact --scope components,frontend-admin,frontend-public
info cli using local version of lerna
lerna notice cli v3.8.4
lerna info filter [ 'components,frontend-admin,frontend-public' ]
lerna ERR! EFILTER No packages remain after filtering [ 'components,frontend-admin,frontend-public' ]
✘-1 ~/workspace/s24 [master|●1✚ 5…2]
Tryout 3, resulting success
$ lerna add react --exact --scope=components --scope=frontend-admin --scope=frontend-public
info cli using local version of lerna
lerna notice cli v3.8.4
lerna info filter [ 'components', 'frontend-admin', 'frontend-public' ]
lerna info Adding react in 3 packages
lerna info filter [ 'components', 'frontend-admin', 'frontend-public' ]
lerna info bootstrap root only
yarn install v1.12.3
[1/4] Resolving packages...
[2/4] Fetching packages...
[3/4] Linking dependencies...
[4/4] Building fresh packages...
success Saved lockfile.
Done in 3.13s.
Possible Solution
If package name contains comma ,, split it.
lerna.json
{
"packages": [
"packages/*"
],
"version": "0.0.0",
"npmClient": "yarn",
"useWorkspaces": true
}
Context
I would like to add package to multiple packages without writing to much.
Your Environment
| Executable | Version |
|---|---|
lerna --version |
3.8.1 |
npm --version |
5.6.0 |
yarn --version |
1.12.3 |
node --version |
8.11.4 |
| OS | Version |
|---|---|
| Ubuntu | 18.04 |
Issue Analytics
- State:
- Created 5 years ago
- Comments:12 (3 by maintainers)
Top Results From Across the Web
using glob with lerna --scope filtering by package name or ...
I just checked in my own lerna monorepo and found that using the --scope flag in a lerna command definitely refers to names...
Read more >Untitled
**Lerna is a tool that optimizes the workflow around managing multi-package repositories with git and npm.** Lerna can also reduce the time and...
Read more >CLI Reference - Turborepo
Globs against package.json name field (and not the file system.) turbo run lint --scope="@example ...
Read more >Contributing - Refine Dev
If you don't want to start all packages in development mode, ... for only the packages you are working on by providing comma...
Read more >@zmotivat0r/mrepo - npm
There are no other projects in the npm registry using @zmotivat0r/mrepo. ... of scope package(s), comma-separated -h, --help display info.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
it’s a glob pattern, so you can
lerna add react --exact --scope '{components,frontend-admin,frontend-public}'(use quotes to prevent glob expansion by the shell).In case anyone else runs into this, I had to double quote the argument passed to
--scope, maybe because I’m runninglernaviayarn?edit:
I can avoid the use of quotes altogether if I use
--scope=