Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit f879c10

Browse files
wraithgarnlf
authored andcommittedOct 14, 2021
feat(workspaces): add --include-workspace-root and explicit --no-workspaces
Adds a new config item that includes the workspace root. This also changes --workspaces to a trinary, so that setting it to false will explicitly exclude workspaces altogether.
1 parent 0f69d29 commit f879c10

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

72 files changed

+1221
-285
lines changed
 

‎docs/content/commands/npm-audit.md

+27-5
Original file line numberDiff line numberDiff line change
@@ -313,8 +313,8 @@ Valid values for the `workspace` config are either:
313313

314314
* Workspace names
315315
* Path to a workspace directory
316-
* Path to a parent workspace directory (will result to selecting all of the
317-
nested workspaces)
316+
* Path to a parent workspace directory (will result in selecting all
317+
workspaces within that folder)
318318

319319
When set for the `npm init` command, this may be set to the folder of a
320320
workspace which does not yet exist, to create the folder and set it up as a
@@ -327,17 +327,39 @@ This value is not exported to the environment for child processes.
327327

328328
#### `workspaces`
329329

330-
* Default: false
331-
* Type: Boolean
330+
* Default: null
331+
* Type: null or Boolean
332332

333-
Enable running a command in the context of **all** the configured
333+
Set to true to run the command in the context of **all** configured
334334
workspaces.
335335

336+
Explicitly setting this to false will cause commands like `install` to
337+
ignore workspaces altogether. When not set explicitly:
338+
339+
- Commands that operate on the `node_modules` tree (install, update, etc.)
340+
will link workspaces into the `node_modules` folder. - Commands that do
341+
other things (test, exec, publish, etc.) will operate on the root project,
342+
_unless_ one or more workspaces are specified in the `workspace` config.
343+
336344
This value is not exported to the environment for child processes.
337345

338346
<!-- automatically generated, do not edit manually -->
339347
<!-- see lib/utils/config/definitions.js -->
340348

349+
#### `include-workspace-root`
350+
351+
* Default: false
352+
* Type: Boolean
353+
354+
Include the workspace root when workspaces are enabled for a command.
355+
356+
When false, specifying individual workspaces via the `workspace` config, or
357+
all workspaces via the `workspaces` flag, will cause npm to operate only on
358+
the specified workspaces, and not on the root project.
359+
360+
<!-- automatically generated, do not edit manually -->
361+
<!-- see lib/utils/config/definitions.js -->
362+
341363
<!-- AUTOGENERATED CONFIG DESCRIPTIONS END -->
342364

343365
### See Also

‎docs/content/commands/npm-dedupe.md

+27-5
Original file line numberDiff line numberDiff line change
@@ -247,8 +247,8 @@ Valid values for the `workspace` config are either:
247247
248248
* Workspace names
249249
* Path to a workspace directory
250-
* Path to a parent workspace directory (will result to selecting all of the
251-
nested workspaces)
250+
* Path to a parent workspace directory (will result in selecting all
251+
workspaces within that folder)
252252
253253
When set for the `npm init` command, this may be set to the folder of a
254254
workspace which does not yet exist, to create the folder and set it up as a
@@ -261,17 +261,39 @@ This value is not exported to the environment for child processes.
261261
262262
#### `workspaces`
263263
264-
* Default: false
265-
* Type: Boolean
264+
* Default: null
265+
* Type: null or Boolean
266266
267-
Enable running a command in the context of **all** the configured
267+
Set to true to run the command in the context of **all** configured
268268
workspaces.
269269
270+
Explicitly setting this to false will cause commands like `install` to
271+
ignore workspaces altogether. When not set explicitly:
272+
273+
- Commands that operate on the `node_modules` tree (install, update, etc.)
274+
will link workspaces into the `node_modules` folder. - Commands that do
275+
other things (test, exec, publish, etc.) will operate on the root project,
276+
_unless_ one or more workspaces are specified in the `workspace` config.
277+
270278
This value is not exported to the environment for child processes.
271279
272280
<!-- automatically generated, do not edit manually -->
273281
<!-- see lib/utils/config/definitions.js -->
274282
283+
#### `include-workspace-root`
284+
285+
* Default: false
286+
* Type: Boolean
287+
288+
Include the workspace root when workspaces are enabled for a command.
289+
290+
When false, specifying individual workspaces via the `workspace` config, or
291+
all workspaces via the `workspaces` flag, will cause npm to operate only on
292+
the specified workspaces, and not on the root project.
293+
294+
<!-- automatically generated, do not edit manually -->
295+
<!-- see lib/utils/config/definitions.js -->
296+
275297
<!-- AUTOGENERATED CONFIG DESCRIPTIONS END -->
276298
277299
### See Also

0 commit comments

Comments
 (0)
Please sign in to comment.