Skip to content

Commit 4d1d8a9

Browse files
Nathan Fritzlukekarryswraithgar
authored
docs: describe implicit workspace and prefix configuration (#5221)
* docs: describe implicit workspace and prefix configuration * Update docs/content/using-npm/workspaces.md Co-authored-by: Gar <[email protected]> Co-authored-by: Luke Karrys <[email protected]> Co-authored-by: Gar <[email protected]>
1 parent 62b95a0 commit 4d1d8a9

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

docs/content/using-npm/workspaces.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,8 @@ nested workspaces to be consumed elsewhere.
137137

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

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

161-
This will run the `test` script defined within the
163+
You could also run the command within the workspace.
164+
165+
```
166+
cd packages/a && npm run test
167+
```
168+
169+
Either will run the `test` script defined within the
162170
`./packages/a/package.json` file.
163171

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

0 commit comments

Comments
 (0)