Support `--scope <packages-folder>/*`
See original GitHub issueIt seems that it doesn’t work if you want, for example, call lerna exec --scope packages/*
(script for all packages in ./packages/
folder. I want this because I have two folders: one for packages and one for examples.
Because of that I have to, temporarily, use prefixes in names (packages/package-components-foo
, packages/package-utils
) with lerna exec --scope package-* -- babel src --out-dir lib
.
Example:
npm script:
lerna exec --scope packages/* -- babel src --out-dir lib
Expected Behavior
Calls for all packages in ./packages
folder.
Current Behavior
Error: No packages found that match scope ‘packages/*’.
Possible Solution
I don’t know how to implement it but it should be possible.
root package.json
(only specific for monorepo with Yarn workspaces)
{
"workspaces": ["examples/*", "packages/*"],
}
lerna.json
{
"lerna": "2.11.0",
"version": "0.0.0",
"npmClient": "yarn",
"useWorkspaces": true
}
lerna-debug.log
0 silly input [ 'babel', 'src', '--out-dir', 'lib', '--watch' ]
1 silly flags { _: [ 'exec' ],
1 silly flags 'reject-cycles': false,
1 silly flags rejectCycles: false,
1 silly flags stream: true,
1 silly flags parallel: true,
1 silly flags scope: 'packages/*',
1 silly flags since: '',
1 silly flags command: 'babel',
1 silly flags args: [ 'src', '--out-dir', 'lib', '--watch' ] }
2 verbose rootPath C:\Users\m24ma\Documents\projekty\_sandbox\lerna\scope
3 info version 2.11.0
4 silly existsSync C:\Users\m24ma\Documents\projekty\_sandbox\lerna\scope\VERSION
5 info scope packages/*
6 error EPACKAGES Errored while collecting packages and package graph
7 error Error: No packages found that match scope 'packages/*'
7 error at Function.filterPackages (C:\Users\m24ma\Documents\projekty\_sandbox\lerna\scope\node_modules\lerna\lib\PackageUtilities.js:252:17)
7 error at ExecCommand.runPreparations (C:\Users\m24ma\Documents\projekty\_sandbox\lerna\scope\node_modules\lerna\lib\Command.js:333:60)
7 error at C:\Users\m24ma\Documents\projekty\_sandbox\lerna\scope\node_modules\lerna\lib\Command.js:209:18
7 error at new Promise (<anonymous>)
7 error at ExecCommand.run (C:\Users\m24ma\Documents\projekty\_sandbox\lerna\scope\node_modules\lerna\lib\Command.js:193:14)
7 error at Object.handler (C:\Users\m24ma\Documents\projekty\_sandbox\lerna\scope\node_modules\lerna\lib\commands\ExecCommand.js:45:14)
7 error at Object.self.runCommand (C:\Users\m24ma\Documents\projekty\_sandbox\lerna\scope\node_modules\yargs\lib\command.js:233:22)
7 error at Object.Yargs.self._parseArgs (C:\Users\m24ma\Documents\projekty\_sandbox\lerna\scope\node_modules\yargs\yargs.js:990:30)
7 error at Object.Yargs.self.parse (C:\Users\m24ma\Documents\projekty\_sandbox\lerna\scope\node_modules\yargs\yargs.js:532:23)
Context
It is useful when you have special directory for apps and special one for packages. These two groups maybe needs totally different bundle configs and scripts.
Your Environment
Executable | Version |
---|---|
lerna --version |
2.11.0 |
npm --version |
6.1.0 |
yarn --version |
1.7.0 |
node --version |
10.3.0 |
OS | Version |
---|---|
Windows 10 | 1803 |
Issue Analytics
- State:
- Created 5 years ago
- Reactions:30
- Comments:14 (3 by maintainers)
Would really like to have this feature- it’s painful to have list everything out. Any reason this issue is gone cold?
haha yeah… Gotta love open source…
There is a simple solution. If you use scoped packages – as you really should – you are able to do as follows:
lerna exec --parallel --scope '@mui-org/*
That will run any package scoped to your npm organisation… Thinking that your other tree will usually be actual web sites / apps or such