Note: Examples use bw
instead of bunx bun-workspaces
, which works assuming you have either ran alias bw="bunx bun-workspaces"
or placed it in your shell configuration file.
--configFile
| -c
Use this option to point to a config file. Otherwise, ./bw.json is used by default.
$ bw --configFile=/path/to/your/config.json list-workspaces
$ bw -c /path/to/your/config.json list-workspaces
--cwd
| -d
Default: .
Get the project root from a specific directory. This should be where the root package.json of your project is located.
$ bw --cwd=/path/to/your/project list-workspaces
$ bw -d /path/to/your/project list-workspaces
--logLevel
| -l
Values: debug
info
warn
error
silent
Default: info
Set the logging level. Script output of workspaces is always preserved, except when log level is set to "silent".
$ bw --logLevel=silent list-workspaces
$ bw -l error list-workspaces
list-scripts
List all scripts available with their workspaces
--name-only
Only show script names
--json
Output as JSON
--pretty
Pretty print JSON
$ # Default output. Shows metadata about scripts found in all workspaces
$ bw list-scripts
$
$ # Output only the list of script names
$ bw list-scripts --name-only
$
$ # Output as JSON
$ bw list-scripts --json
$
$ # Output as formatted JSON
$ bw list-scripts --json --pretty
list-workspaces [pattern]
Aliases: ls
list
List all workspaces found in the project. This uses the "workspaces" field in your root package.json file.
--name-only
Only show workspace names
--json
Output as JSON
--pretty
Pretty print JSON
$ # Default output. Shows metadata about workspaces found in all workspaces
$ bw list-workspaces
$
$ # Output only the list of workspace names
$ bw list-workspaces --name-only
$
$ # Output as JSON
$ bw list-workspaces --json
$
$ # Output as formatted JSON
$ bw list-workspaces --json --pretty
workspace-info <workspace>
Aliases: info
Show metadata about a workspace
--json
Output as JSON
--pretty
Pretty print JSON
$ # Default output. Shows metadata about a workspace
$ bw workspace-info my-workspace
$
$ # Output as JSON
$ bw workspace-info --json
$
$ # Output as formatted JSON
$ bw workspace-info --json --pretty
script-info <script>
Show metadata about a script
--workspaces-only
Only show script's workspace names
--json
Output as JSON
--pretty
Pretty print JSON
$ # Default output. Shows metadata about a script
$ bw script-info my-script
$
$ # Output only the list of workspaces that have the script
$ bw script-info my-script --workspaces-only
$
$ # Output as JSON
$ bw script-info --json
$
$ # Output as formatted JSON
$ bw script-info --json --pretty
run <script> [workspaces...]
Run a script in all workspaces that have it in their "scripts" field in their respective package.json.
--parallel
Run the scripts in parallel
--args <args>
Args to append to the script command
--noPrefix
Do not prefix the workspace name to the script output
$ # Run a script for all workspaces that have it in their `scripts` field
$ bw run my-script
$
$ # Run a scripts in parallel (logs are prefixed by default)
$ bw run my-script --parallel
$
$ # By default, a prefix is added to the script output with the workspace name
$ bw run my-script --noPrefix
$
$ # Run a script for a specific workspace
$ bw run my-script my-workspace
$
$ # Run a script for multiple workspaces
$ bw run my-script my-workspace-a my-workspace-b
$
$ # Run a script for workspaces using wildcard (does not take into account workspace aliases)
$ bw run my-script my-workspace-*"
$
$ # Append args to each script call
$ bw run my-script --args="--my args"
$
$ # Use the workspace name in args
$ bw run my-script --args="--my --arg=<workspace>"