Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: describe implicit workspace and prefix configuration #5221

Merged
merged 2 commits into from Jul 27, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 9 additions & 1 deletion docs/content/using-npm/workspaces.md
Expand Up @@ -137,6 +137,8 @@ nested workspaces to be consumed elsewhere.

You can use the `workspace` configuration option to run commands in the context
of a configured workspace.
Additionally, if your current directory is in a workspace, the `workspace`
configuration is implicitly set, and `prefix` is set to the root workspace.

Following is a quick example on how to use the `npm run` command in the context
of nested workspaces. For a project containing multiple workspaces, e.g:
Expand All @@ -158,7 +160,13 @@ given command in the context of that specific workspace. e.g:
npm run test --workspace=a
```

This will run the `test` script defined within the
You could also run the command within the workspace.

```
cd packages/a && npm run test
```

Either will run the `test` script defined within the
`./packages/a/package.json` file.

Please note that you can also specify this argument multiple times in the
Expand Down