Open wdfinch opened 3 years ago
yarn workspaces foreach --include packages/* run build
The docs specify that it expects the names of your workspaces, not their paths https://yarnpkg.com/cli/workspaces/foreach#options-include%20%230 also since you're not quoting the glob pattern your shell expands it and actually passes yarn workspaces foreach --include packages/foo packages/bar [...] run build
which is not a valid command
Thanks for the reply. That makes sense. I'm still having issues getting this to work. Could you please post an example or two of a valid command here?
It's confusing because yarn workspaces list
shows the names as paths so I would think to use one of these. Additionally the docs say "An array of glob pattern idents" rather than names. I'm not sure of the exact format this would be in.
My issue is I didn't have the plugin installed. It would be nice if the commands on the website could show an error saying you need a certain plugin installed in order to use them. I know it's on the docs, but this could help as well.
It's supposed to do that but It seems it broke and we don't have tests covering it - https://github.com/yarnpkg/berry/blob/bef203949d9acbd42da9b47b2a2dfe3615764eaf/packages/plugin-essentials/sources/commands/run.ts#L151-L154
Gotcha. Ok thanks.
It's supposed to do that but It seems it broke and we don't have tests covering it -
It seems to be a bug in the Clipanion state machine since it throws an Unknown Syntax Error
. I'll try looking into it. 🤔
Clipanion repro:
Run this CLI with foo bar
and it will throw an Unknown Syntax Error
instead of being interpreted as an EntryCommand
:
import {Cli, Command, Option} from 'clipanion';
class EntryCommand extends Command {
first = Option.String();
args = Option.Proxy();
async execute() {
}
}
class FooBazCommand extends Command {
static paths = [[`foo`, `baz`]];
async execute() {
}
}
const cli = Cli.from([EntryCommand, FooBazCommand]);
console.log(cli.process(process.argv.slice(2)));
Describe the user story
I can't figure out how to use yarn workspaces foreach --include or --exclude from the docs. Some intuitive commands I have tried are:
Every time I run the command I get the following output:
Describe the solution you'd like
I would really appreciate it if someone could add an example to the website docs on how to do this. Additionally, I think a better error message would be nice as "Unknown Syntax Error: Command not found; did you mean:" does not give me enough detail.
Describe the drawbacks of your solution
None
Describe alternatives you've considered
Asking in the discussion although this wouldn't solve the confusion for others.