Lerna: multiple --scope seems to combine into comma-delimited value, but single --scope with same comma-delimited value doesn't work

Created on 18 Mar 2017  Â·  3Comments  Â·  Source: lerna/lerna

The below two commands don't seems to work the same, despite the output of the first command making it look like the second command should work ...

C:\Users\Ryan\Projects\esal\packages\api [lerna ≡ +0 ~1 -0 !]> lerna ls --scope *api* --scope *site*
Lerna v2.0.0-beta.38
Scoping to packages that match '*api*,*site*'
esal-api  v0.1.0
esal-site v0.0.1

C:\Users\Ryan\Projects\esal\packages\api [lerna ≡ +0 ~1 -0 !]> lerna ls --scope *api*,*site*
Lerna v2.0.0-beta.38
Scoping to packages that match '*api*,*site*'
Errored while collecting packages and package graph
Error: No packages found that match '*api*,*site*'
    at Function._filterPackages (C:\Users\Ryan\AppData\Roaming\npm\node_modules\lerna\lib\PackageUtilities.js:197:15)
    at Function.filterPackages (C:\Users\Ryan\AppData\Roaming\npm\node_modules\lerna\lib\PackageUtilities.js:168:37)
    at LsCommand.runPreparations (C:\Users\Ryan\AppData\Roaming\npm\node_modules\lerna\lib\Command.js:184:60)
    at LsCommand.run (C:\Users\Ryan\AppData\Roaming\npm\node_modules\lerna\lib\Command.js:109:12)
    at Object.<anonymous> (C:\Users\Ryan\AppData\Roaming\npm\node_modules\lerna\bin\lerna.js:72:11)
    at Module._compile (module.js:571:32)
    at Object.Module._extensions..js (module.js:580:10)
    at Module.load (module.js:488:32)
    at tryModuleLoad (module.js:447:12)
    at Function.Module._load (module.js:439:3)

I'm on Windows, using PowerShell, and am having a hard time getting globs to work because PowerShell doesn't interpret the syntax the same as bash. I can't get a glob like "(api|site)*" to work, etc. The pipe seems to be some hard delimiter for PowerShell itself, despite being within quotes.

So, that lead me to just trying to use two --scopes, which works. I saw the output of that though which makes it look like specifying two --scope just combines them as a comma delimited list. So I tried just specifying it as a comma list, but that doesn't seem to function the same, under the hood.

Not sure if bug, or just visual output doesn't represent what actually happens under the hood, etc. Figured I'd bring it up as a bug just in case it actually is.

question

Most helpful comment

Not sure if bug, or just visual output doesn't represent what actually happens under the hood

Yep, just a matter of output. Multiple --scope values are handled as an array. The comma-separation is just how the array gets printed.

You could combine --scope=*api* and --scope=*site* in a single glob as --scope=*{api,site}*.

All 3 comments

Not sure if bug, or just visual output doesn't represent what actually happens under the hood

Yep, just a matter of output. Multiple --scope values are handled as an array. The comma-separation is just how the array gets printed.

You could combine --scope=*api* and --scope=*site* in a single glob as --scope=*{api,site}*.

Got it. Thanks @gigabo, that answers my question!

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.

Was this page helpful?
0 / 5 - 0 ratings