Skip to content

Commit 1952f8b

Browse files
wraithgarfritzy
authored andcommitted
feat(workspaces): --include-workspace-root
Adds a new config item that includes the workspace root when running non-arborist commands (i.e. repo, version, publish). Arborist will need to be udpated to look for this flag to change its behavior to include the workspace root for its functions. This also changes --workspaces to a trinary, so that setting it to false will explicitly exclude workspaces altogether. This is also going to require an arborist change so that it ignores workspaces altogether. Co-author: @fritzy PR-URL: #3816 Credit: @isaacs Close: #3816 Reviewed-by: @wraithgar
1 parent 827494c commit 1952f8b

Some content is hidden

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

74 files changed

+1219
-282
lines changed

docs/content/commands/npm-audit.md

Lines changed: 27 additions & 5 deletions
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

Lines changed: 27 additions & 5 deletions
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

docs/content/commands/npm-diff.md

Lines changed: 27 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -286,8 +286,8 @@ Valid values for the `workspace` config are either:
286286
287287
* Workspace names
288288
* Path to a workspace directory
289-
* Path to a parent workspace directory (will result to selecting all of the
290-
nested workspaces)
289+
* Path to a parent workspace directory (will result in selecting all
290+
workspaces within that folder)
291291
292292
When set for the `npm init` command, this may be set to the folder of a
293293
workspace which does not yet exist, to create the folder and set it up as a
@@ -300,17 +300,39 @@ This value is not exported to the environment for child processes.
300300
301301
#### `workspaces`
302302
303-
* Default: false
304-
* Type: Boolean
303+
* Default: null
304+
* Type: null or Boolean
305305
306-
Enable running a command in the context of **all** the configured
306+
Set to true to run the command in the context of **all** configured
307307
workspaces.
308308
309+
Explicitly setting this to false will cause commands like `install` to
310+
ignore workspaces altogether. When not set explicitly:
311+
312+
- Commands that operate on the `node_modules` tree (install, update, etc.)
313+
will link workspaces into the `node_modules` folder. - Commands that do
314+
other things (test, exec, publish, etc.) will operate on the root project,
315+
_unless_ one or more workspaces are specified in the `workspace` config.
316+
309317
This value is not exported to the environment for child processes.
310318
311319
<!-- automatically generated, do not edit manually -->
312320
<!-- see lib/utils/config/definitions.js -->
313321
322+
#### `include-workspace-root`
323+
324+
* Default: false
325+
* Type: Boolean
326+
327+
Include the workspace root when workspaces are enabled for a command.
328+
329+
When false, specifying individual workspaces via the `workspace` config, or
330+
all workspaces via the `workspaces` flag, will cause npm to operate only on
331+
the specified workspaces, and not on the root project.
332+
333+
<!-- automatically generated, do not edit manually -->
334+
<!-- see lib/utils/config/definitions.js -->
335+
314336
<!-- AUTOGENERATED CONFIG DESCRIPTIONS END -->
315337
## See Also
316338

docs/content/commands/npm-dist-tag.md

Lines changed: 27 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -106,8 +106,8 @@ Valid values for the `workspace` config are either:
106106

107107
* Workspace names
108108
* Path to a workspace directory
109-
* Path to a parent workspace directory (will result to selecting all of the
110-
nested workspaces)
109+
* Path to a parent workspace directory (will result in selecting all
110+
workspaces within that folder)
111111

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

121121
#### `workspaces`
122122

123-
* Default: false
124-
* Type: Boolean
123+
* Default: null
124+
* Type: null or Boolean
125125

126-
Enable running a command in the context of **all** the configured
126+
Set to true to run the command in the context of **all** configured
127127
workspaces.
128128

129+
Explicitly setting this to false will cause commands like `install` to
130+
ignore workspaces altogether. When not set explicitly:
131+
132+
- Commands that operate on the `node_modules` tree (install, update, etc.)
133+
will link workspaces into the `node_modules` folder. - Commands that do
134+
other things (test, exec, publish, etc.) will operate on the root project,
135+
_unless_ one or more workspaces are specified in the `workspace` config.
136+
129137
This value is not exported to the environment for child processes.
130138

131139
<!-- automatically generated, do not edit manually -->
132140
<!-- see lib/utils/config/definitions.js -->
133141

142+
#### `include-workspace-root`
143+
144+
* Default: false
145+
* Type: Boolean
146+
147+
Include the workspace root when workspaces are enabled for a command.
148+
149+
When false, specifying individual workspaces via the `workspace` config, or
150+
all workspaces via the `workspaces` flag, will cause npm to operate only on
151+
the specified workspaces, and not on the root project.
152+
153+
<!-- automatically generated, do not edit manually -->
154+
<!-- see lib/utils/config/definitions.js -->
155+
134156
<!-- AUTOGENERATED CONFIG DESCRIPTIONS END -->
135157

136158
### See Also

docs/content/commands/npm-docs.md

Lines changed: 27 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,8 @@ Valid values for the `workspace` config are either:
6363
6464
* Workspace names
6565
* Path to a workspace directory
66-
* Path to a parent workspace directory (will result to selecting all of the
67-
nested workspaces)
66+
* Path to a parent workspace directory (will result in selecting all
67+
workspaces within that folder)
6868
6969
When set for the `npm init` command, this may be set to the folder of a
7070
workspace which does not yet exist, to create the folder and set it up as a
@@ -77,17 +77,39 @@ This value is not exported to the environment for child processes.
7777
7878
#### `workspaces`
7979
80-
* Default: false
81-
* Type: Boolean
80+
* Default: null
81+
* Type: null or Boolean
8282
83-
Enable running a command in the context of **all** the configured
83+
Set to true to run the command in the context of **all** configured
8484
workspaces.
8585
86+
Explicitly setting this to false will cause commands like `install` to
87+
ignore workspaces altogether. When not set explicitly:
88+
89+
- Commands that operate on the `node_modules` tree (install, update, etc.)
90+
will link workspaces into the `node_modules` folder. - Commands that do
91+
other things (test, exec, publish, etc.) will operate on the root project,
92+
_unless_ one or more workspaces are specified in the `workspace` config.
93+
8694
This value is not exported to the environment for child processes.
8795
8896
<!-- automatically generated, do not edit manually -->
8997
<!-- see lib/utils/config/definitions.js -->
9098
99+
#### `include-workspace-root`
100+
101+
* Default: false
102+
* Type: Boolean
103+
104+
Include the workspace root when workspaces are enabled for a command.
105+
106+
When false, specifying individual workspaces via the `workspace` config, or
107+
all workspaces via the `workspaces` flag, will cause npm to operate only on
108+
the specified workspaces, and not on the root project.
109+
110+
<!-- automatically generated, do not edit manually -->
111+
<!-- see lib/utils/config/definitions.js -->
112+
91113
<!-- AUTOGENERATED CONFIG DESCRIPTIONS END -->
92114
93115
### See Also

docs/content/commands/npm-exec.md

Lines changed: 27 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -164,8 +164,8 @@ Valid values for the `workspace` config are either:
164164

165165
* Workspace names
166166
* Path to a workspace directory
167-
* Path to a parent workspace directory (will result to selecting all of the
168-
nested workspaces)
167+
* Path to a parent workspace directory (will result in selecting all
168+
workspaces within that folder)
169169

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

179179
#### `workspaces`
180180

181-
* Default: false
182-
* Type: Boolean
181+
* Default: null
182+
* Type: null or Boolean
183183

184-
Enable running a command in the context of **all** the configured
184+
Set to true to run the command in the context of **all** configured
185185
workspaces.
186186

187+
Explicitly setting this to false will cause commands like `install` to
188+
ignore workspaces altogether. When not set explicitly:
189+
190+
- Commands that operate on the `node_modules` tree (install, update, etc.)
191+
will link workspaces into the `node_modules` folder. - Commands that do
192+
other things (test, exec, publish, etc.) will operate on the root project,
193+
_unless_ one or more workspaces are specified in the `workspace` config.
194+
187195
This value is not exported to the environment for child processes.
188196

189197
<!-- automatically generated, do not edit manually -->
190198
<!-- see lib/utils/config/definitions.js -->
191199

200+
#### `include-workspace-root`
201+
202+
* Default: false
203+
* Type: Boolean
204+
205+
Include the workspace root when workspaces are enabled for a command.
206+
207+
When false, specifying individual workspaces via the `workspace` config, or
208+
all workspaces via the `workspaces` flag, will cause npm to operate only on
209+
the specified workspaces, and not on the root project.
210+
211+
<!-- automatically generated, do not edit manually -->
212+
<!-- see lib/utils/config/definitions.js -->
213+
192214
<!-- AUTOGENERATED CONFIG DESCRIPTIONS END -->
193215

194216
### Examples

docs/content/commands/npm-explain.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,8 @@ Valid values for the `workspace` config are either:
8585

8686
* Workspace names
8787
* Path to a workspace directory
88-
* Path to a parent workspace directory (will result to selecting all of the
89-
nested workspaces)
88+
* Path to a parent workspace directory (will result in selecting all
89+
workspaces within that folder)
9090

9191
When set for the `npm init` command, this may be set to the folder of a
9292
workspace which does not yet exist, to create the folder and set it up as a

docs/content/commands/npm-find-dupes.md

Lines changed: 27 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -174,8 +174,8 @@ Valid values for the `workspace` config are either:
174174

175175
* Workspace names
176176
* Path to a workspace directory
177-
* Path to a parent workspace directory (will result to selecting all of the
178-
nested workspaces)
177+
* Path to a parent workspace directory (will result in selecting all
178+
workspaces within that folder)
179179

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

189189
#### `workspaces`
190190

191-
* Default: false
192-
* Type: Boolean
191+
* Default: null
192+
* Type: null or Boolean
193193

194-
Enable running a command in the context of **all** the configured
194+
Set to true to run the command in the context of **all** configured
195195
workspaces.
196196

197+
Explicitly setting this to false will cause commands like `install` to
198+
ignore workspaces altogether. When not set explicitly:
199+
200+
- Commands that operate on the `node_modules` tree (install, update, etc.)
201+
will link workspaces into the `node_modules` folder. - Commands that do
202+
other things (test, exec, publish, etc.) will operate on the root project,
203+
_unless_ one or more workspaces are specified in the `workspace` config.
204+
197205
This value is not exported to the environment for child processes.
198206

199207
<!-- automatically generated, do not edit manually -->
200208
<!-- see lib/utils/config/definitions.js -->
201209

210+
#### `include-workspace-root`
211+
212+
* Default: false
213+
* Type: Boolean
214+
215+
Include the workspace root when workspaces are enabled for a command.
216+
217+
When false, specifying individual workspaces via the `workspace` config, or
218+
all workspaces via the `workspaces` flag, will cause npm to operate only on
219+
the specified workspaces, and not on the root project.
220+
221+
<!-- automatically generated, do not edit manually -->
222+
<!-- see lib/utils/config/definitions.js -->
223+
202224
<!-- AUTOGENERATED CONFIG DESCRIPTIONS END -->
203225

204226
### See Also

docs/content/commands/npm-fund.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,8 +122,8 @@ Valid values for the `workspace` config are either:
122122

123123
* Workspace names
124124
* Path to a workspace directory
125-
* Path to a parent workspace directory (will result to selecting all of the
126-
nested workspaces)
125+
* Path to a parent workspace directory (will result in selecting all
126+
workspaces within that folder)
127127

128128
When set for the `npm init` command, this may be set to the folder of a
129129
workspace which does not yet exist, to create the folder and set it up as a

0 commit comments

Comments
 (0)