question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Support `--scope <packages-folder>/*`

See original GitHub issue

It 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:open
  • Created 5 years ago
  • Reactions:30
  • Comments:14 (3 by maintainers)

github_iconTop GitHub Comments

20reactions
rjhilgefortcommented, Apr 19, 2019

Would really like to have this feature- it’s painful to have list everything out. Any reason this issue is gone cold?

3reactions
andrewmclagancommented, Oct 18, 2019

haha yeah… Gotta love open source…

I want it, but i dont want to do it myself.


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

Read more comments on GitHub >

github_iconTop Results From Across the Web

scope - npm Docs
Scoped packages are installed to a sub-folder of the regular installation folder, e.g. if your other packages are installed in node_modules/packagename , scoped ......
Read more >
Ubuntu Manpage: npm-scope - Scoped packages
Scoped packages are installed to a sub-folder of the regular installation folder, e.g. if your other packages are installed in node_modules/packagename, scoped ...
Read more >
Scopes and file colors | IntelliJ IDEA Documentation - JetBrains
is a group of files, packages, and folders in a project. You can use scopes to visually distinguish project items in different IDE...
Read more >
Common NuGet configurations | Microsoft Learn
Config file also specifically configures package sources. ... previous location was /etc/opt , and on Mac, /Library/Application Support .
Read more >
Setup for scoped registries (private registries) - Unity Forum
By using scopes, a package will always be mapped to one and only one registry, guaranteeing a consistent result regardless of network conditions ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found