portform.blogg.se

Yarn workspaces foreach
Yarn workspaces foreach









  1. YARN WORKSPACES FOREACH HOW TO
  2. YARN WORKSPACES FOREACH FREE

Since those two functions have similar options, I'd suggest to write a streamUtils.ts file inside your new plugin (similar to the other util libraries in the repo) that you could use to share the same logic across both commands.Implement a plugin named yarn workspaces foreach.I'd prefer not - this type of settings is dangerous since it creates vastly different environments and might break users expectations when moving from a project to another. This could potentially be stored in a config but is that really a good idea? Yep, await Promise.all is fair game (the v2 targets Node 8+ so we even have native async/await). The added benefit being that -skip-missing wouldn't be a valid option for the generic yarn workspaces foreach command (which makes sense it wouldn't have any effect).

yarn workspaces foreach

This actually has a pretty simple solution - now that the CLI uses clipanion, we can simply override yarn workspaces foreach to declare a special command named yarn workspaces foreach run (and we can hide it from the help).

YARN WORKSPACES FOREACH FREE

The plugin documentation is currently here, and feel free to ask me any question on Discord. One potential extra option I can see would be -interlaced which would guarantee that the output from each running process wouldn't be conflated with the other ones on the same terminal row - but that can be done later.Ĭould you implement this command in a plugin? I think we would eventually want to bundle it by default anyway, but I think it would be worthwhile to have a plugin whose only goal is to contain the commands specific to workspaces, if only to make them more easily discoverable by the other contributors. One thing is that instead of -colors I believe it should be -prefix (and the prefixed being colored or not should then be based on the value of the enableColors configuration settings). Now that we've changed the CLI framework it's also much clearer how those options would interact with "proxied" commands (they would simply have to be put before the final command name component), so I don't have as many objections. Overall I see the point of those features. Hey, thanks for opening an issue about this! I'm not sure the best way to go about doing it right now.

YARN WORKSPACES FOREACH HOW TO

I'd be willing to implement a solution if I could get some suggestions/consensus on how to tackle the problem. Trying to adopt Yarn Workspaces for my new project, lots of redundant issues for these features exist on the v1 repo. Note that this approach means you must ALWAYS pass -skip-missing when calling the yarn workspaces foreach command. While useless when used directly, it allows us to simply do: yarn workspaces foreach run -skip-missing

  • yarn run -skip-missing might be a better place for the flag.
  • Promise.all() seems promising if the Promise API is available in yarn.
  • We'll need a unique way to isolate missing script errors from regular script errors. Thinking about Promise.all() assuming the Promise API is available within Yarn(?). It has no knowledge of what sort of command is being executed ( npm run, etc) so detecting missing scripts from here feels messy.Īdditionally, I'm not sure how to do await in parallel. Yarn workspaces foreach is a dead-simple command that simply forwards an arbitrary yarn command to each package.
  • -prefix Prefix / colorize script output per package.
  • -skip-missing Skip packages that don't have the specified script.
  • -parallel Run scripts in parallel instead of sequentially.
  • List of yarn workspaces foreach (previously yarn workspaces) desired features (with potential API):

    yarn workspaces foreach

    It would be nice if yarn workspaces commands had slightly more flexibility to remove external dependencies. Most solutions involve using external packages or weird script hacks, voiding some of the merit for yarn workspaces.

    yarn workspaces foreach

    Several feature requests repeatedly pop up for using yarn with workspaces. I'd be willing to implement this feature.











    Yarn workspaces foreach