Options
All
  • Public
  • Public/Protected
  • All
Menu

Class WorkspacesForeachCommand

Hierarchy

Properties

all

all: boolean = Option.Boolean(`-A,--all`, false, {description: `Run the command on all workspaces of a project`,})

args

args: string[] = Option.Proxy()

commandName

commandName: string = Option.String()

cwd

cwd: undefined | string = Option.String(`--cwd`, {hidden: true})

exclude

exclude: string[] = Option.Array(`--exclude`, [], {description: `An array of glob pattern idents; matching workspaces won't be traversed`,})

include

include: string[] = Option.Array(`--include`, [], {description: `An array of glob pattern idents; only matching workspaces will be traversed`,})

interlaced

interlaced: boolean = Option.Boolean(`-i,--interlaced`, false, {description: `Print the output of commands in real-time instead of buffering it`,})

jobs

jobs: undefined | number = Option.String(`-j,--jobs`, {description: `The maximum number of parallel tasks that the execution will be limited to`,validator: t.applyCascade(t.isNumber(), [t.isInteger(), t.isAtLeast(2)]),})

parallel

parallel: boolean = Option.Boolean(`-p,--parallel`, false, {description: `Run the commands in parallel`,})

publicOnly

publicOnly: undefined | false | true = Option.Boolean(`--no-private`, {description: `Avoid running the command on private workspaces`,})

recursive

recursive: boolean = Option.Boolean(`-R,--recursive`, false, {description: `Find packages via dependencies/devDependencies instead of using the workspaces field`,})

topological

topological: boolean = Option.Boolean(`-t,--topological`, false, {description: `Run the command after all workspaces it depends on (regular) have finished`,})

topologicalDev

topologicalDev: boolean = Option.Boolean(`--topological-dev`, false, {description: `Run the command after all workspaces it depends on (regular + dev) have finished`,})

verbose

verbose: boolean = Option.Boolean(`-v,--verbose`, false, {description: `Prefix each output line with the name of the originating workspace`,})

Static paths

paths: string[][] = [[`workspaces`, `foreach`],]

Static usage

usage: Usage = Command.Usage({category: `Workspace-related commands`,description: `run a command on all workspaces`,details: `This command will run a given sub-command on current and all its descendant workspaces. Various flags can alter the exact behavior of the command:- If \`-p,--parallel\` is set, the commands will be ran in parallel; they'll by default be limited to a number of parallel tasks roughly equal to half your core number, but that can be overridden via \`-j,--jobs\`.- If \`-p,--parallel\` and \`-i,--interlaced\` are both set, Yarn will print the lines from the output as it receives them. If \`-i,--interlaced\` wasn't set, it would instead buffer the output from each process and print the resulting buffers only after their source processes have exited.- If \`-t,--topological\` is set, Yarn will only run the command after all workspaces that it depends on through the \`dependencies\` field have successfully finished executing. If \`--topological-dev\` is set, both the \`dependencies\` and \`devDependencies\` fields will be considered when figuring out the wait points.- If \`-A,--all\` is set, Yarn will run the command on all the workspaces of a project. By default yarn runs the command only on current and all its descendant workspaces.- If \`-R,--recursive\` is set, Yarn will find workspaces to run the command on by recursively evaluating \`dependencies\` and \`devDependencies\` fields, instead of looking at the \`workspaces\` fields.- The command may apply to only some workspaces through the use of \`--include\` which acts as a whitelist. The \`--exclude\` flag will do the opposite and will be a list of packages that mustn't execute the script. Both flags accept glob patterns (if valid Idents and supported by [micromatch](https://github.com/micromatch/micromatch)). Make sure to escape the patterns, to prevent your own shell from trying to expand them.Adding the \`-v,--verbose\` flag will cause Yarn to print more information; in particular the name of the workspace that generated the output will be printed at the front of each line.If the command is \`run\` and the script being run does not exist the child workspace will be skipped without error.`,examples: [[`Publish current and all descendant packages`,`yarn workspaces foreach npm publish --tolerate-republish`,], [`Run build script on current and all descendant packages`,`yarn workspaces foreach run build`,], [`Run build script on current and all descendant packages in parallel, building dependent packages first`,`yarn workspaces foreach -pt run build`,]],})

Methods

execute

  • execute(): Promise<0 | 1>

Generated using TypeDoc