Skip to content

Run Scripts

Execute concurrent scripts across all packages in the monorepo simultaneously. This command is useful for running build, test, and other scripts in all packages at once.

Usage

Use the following command to run scripts in all packages:

bash
monopkg run <scripts...> [options]
bash
bun x monopkg run <scripts...> [options]
bash
npx monopkg run <scripts...> [options]
bash
yarn dlx monopkg run <scripts...> [options]

Options

  • -b, --before-run <scripts...> - Execute scripts before the main script.
  • -s, --strict - Wait for the dependencies to be resolved before running the scripts.
  • -f, --filter <packages...> - Include specific packages.
  • -e, --exclude <packages...> - Exclude specific packages.
  • -w, --workspace <workspaces...> - Root workspaces of the packages.
  • --sequential - Run scripts sequentially.
  • --standalone - Run scripts in standalone mode without resolving dependencies.

Examples

Basic Usage

Run build script in interactive mode.

bash
monopkg run build
bash
bun x monopkg run build
bash
npx monopkg run build
bash
yarn dlx monopkg run build

Using Filters

Run test script in package-a and package-b

bash
monopkg run test -f package-a package-b
bash
bun x monopkg run test -f package-a package-b
bash
npx monopkg run test -f package-a package-b
bash
yarn dlx monopkg run test -f package-a package-b

Using Before Run Scripts

The --before-run option allows you to execute scripts before the main script. If provided, the main script will wait for all the before-run scripts to complete before running.

Example

Run clean script before build script in all packages.

bash
monopkg run build --before-run clean -f *
bash
bun x monopkg run build --before-run clean -f *
bash
npx monopkg run build --before-run clean -f *
bash
yarn dlx monopkg run build --before-run clean -f *

Released under the MIT License.