@nx/workspace 20.2.0-canary.20241129-2cb58b9 → 20.2.0-canary.20241130-ec5a5e6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +3 -3
- package/src/generators/new/generate-preset.js +1 -0
- package/src/generators/new/generate-workspace-files.js +11 -4
- package/src/generators/new/new.d.ts +3 -0
- package/src/generators/new/new.js +5 -0
- package/src/generators/new/schema.json +6 -1
- package/src/generators/preset/preset.js +13 -0
- package/src/generators/preset/schema.d.ts +1 -0
- package/src/generators/preset/schema.json +12 -1
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@nx/workspace",
|
3
|
-
"version": "20.2.0-canary.
|
3
|
+
"version": "20.2.0-canary.20241130-ec5a5e6",
|
4
4
|
"private": false,
|
5
5
|
"description": "The Workspace plugin contains executors and generators that are useful for any Nx workspace. It should be present in every Nx workspace and other plugins build on it.",
|
6
6
|
"repository": {
|
@@ -38,12 +38,12 @@
|
|
38
38
|
}
|
39
39
|
},
|
40
40
|
"dependencies": {
|
41
|
-
"@nx/devkit": "20.2.0-canary.
|
41
|
+
"@nx/devkit": "20.2.0-canary.20241130-ec5a5e6",
|
42
42
|
"chalk": "^4.1.0",
|
43
43
|
"enquirer": "~2.3.6",
|
44
44
|
"tslib": "^2.3.0",
|
45
45
|
"yargs-parser": "21.1.1",
|
46
|
-
"nx": "20.2.0-canary.
|
46
|
+
"nx": "20.2.0-canary.20241130-ec5a5e6"
|
47
47
|
},
|
48
48
|
"publishConfig": {
|
49
49
|
"access": "public"
|
@@ -71,6 +71,7 @@ function generatePreset(host, opts) {
|
|
71
71
|
opts.prefix !== undefined ? `--prefix=${opts.prefix}` : null,
|
72
72
|
opts.nxCloudToken ? `--nxCloudToken=${opts.nxCloudToken}` : null,
|
73
73
|
opts.formatter ? `--formatter=${opts.formatter}` : null,
|
74
|
+
opts.workspaces ? `--workspaces` : null,
|
74
75
|
].filter((e) => !!e);
|
75
76
|
}
|
76
77
|
}
|
@@ -325,15 +325,22 @@ function setUpWorkspacesInPackageJson(tree, options) {
|
|
325
325
|
if (options.preset === presets_1.Preset.NPM ||
|
326
326
|
(options.preset === presets_1.Preset.TS &&
|
327
327
|
process.env.NX_ADD_PLUGINS !== 'false' &&
|
328
|
-
process.env.NX_ADD_TS_PLUGIN !== 'false')
|
328
|
+
process.env.NX_ADD_TS_PLUGIN !== 'false') ||
|
329
|
+
((options.preset === presets_1.Preset.Expo ||
|
330
|
+
options.preset === presets_1.Preset.NextJs ||
|
331
|
+
options.preset === presets_1.Preset.ReactMonorepo ||
|
332
|
+
options.preset === presets_1.Preset.ReactNative ||
|
333
|
+
options.preset === presets_1.Preset.RemixMonorepo) &&
|
334
|
+
options.workspaces)) {
|
335
|
+
const workspaces = options.workspaceGlobs ?? ['packages/**'];
|
329
336
|
if (options.packageManager === 'pnpm') {
|
330
|
-
tree.write((0, path_1.join)(options.directory, 'pnpm-workspace.yaml'), `packages:
|
331
|
-
- '
|
337
|
+
tree.write((0, path_1.join)(options.directory, 'pnpm-workspace.yaml'), `packages:
|
338
|
+
- ${workspaces.join('\n - ')}
|
332
339
|
`);
|
333
340
|
}
|
334
341
|
else {
|
335
342
|
(0, devkit_1.updateJson)(tree, (0, path_1.join)(options.directory, 'package.json'), (json) => {
|
336
|
-
json.workspaces =
|
343
|
+
json.workspaces = workspaces;
|
337
344
|
return json;
|
338
345
|
});
|
339
346
|
}
|
@@ -24,11 +24,14 @@ interface Schema {
|
|
24
24
|
useGitHub?: boolean;
|
25
25
|
nxCloud?: 'yes' | 'skip' | 'circleci' | 'github';
|
26
26
|
formatter?: 'none' | 'prettier';
|
27
|
+
workspaces?: boolean;
|
28
|
+
workspaceGlobs?: string | string[];
|
27
29
|
}
|
28
30
|
export interface NormalizedSchema extends Schema {
|
29
31
|
presetVersion?: string;
|
30
32
|
isCustomPreset: boolean;
|
31
33
|
nxCloudToken?: string;
|
34
|
+
workspaceGlobs?: string[];
|
32
35
|
}
|
33
36
|
export declare function newGenerator(tree: Tree, opts: Schema): Promise<() => Promise<void>>;
|
34
37
|
export default newGenerator;
|
@@ -71,6 +71,11 @@ function parsePresetName(input) {
|
|
71
71
|
function normalizeOptions(options) {
|
72
72
|
const normalized = {
|
73
73
|
...options,
|
74
|
+
workspaceGlobs: Array.isArray(options.workspaceGlobs)
|
75
|
+
? options.workspaceGlobs
|
76
|
+
: options.workspaceGlobs
|
77
|
+
? [options.workspaceGlobs]
|
78
|
+
: undefined,
|
74
79
|
};
|
75
80
|
if (!options.directory) {
|
76
81
|
normalized.directory = normalized.name;
|
@@ -50,7 +50,7 @@
|
|
50
50
|
"linter": {
|
51
51
|
"description": "The tool to use for running lint checks.",
|
52
52
|
"type": "string",
|
53
|
-
"enum": ["eslint"],
|
53
|
+
"enum": ["eslint", "none"],
|
54
54
|
"default": "eslint"
|
55
55
|
},
|
56
56
|
"packageManager": {
|
@@ -92,6 +92,11 @@
|
|
92
92
|
"type": "string",
|
93
93
|
"enum": ["none", "prettier"],
|
94
94
|
"default": "none"
|
95
|
+
},
|
96
|
+
"workspaces": {
|
97
|
+
"description": "Whether to use package manager workspaces.",
|
98
|
+
"type": "boolean",
|
99
|
+
"default": false
|
95
100
|
}
|
96
101
|
},
|
97
102
|
"additionalProperties": true
|
@@ -65,6 +65,8 @@ async function createPreset(tree, options) {
|
|
65
65
|
e2eTestRunner: options.e2eTestRunner ?? 'playwright',
|
66
66
|
addPlugin,
|
67
67
|
nxCloudToken: options.nxCloudToken,
|
68
|
+
useTsSolution: options.workspaces,
|
69
|
+
formatter: options.formatter,
|
68
70
|
});
|
69
71
|
}
|
70
72
|
else if (options.preset === presets_1.Preset.ReactStandalone) {
|
@@ -81,6 +83,7 @@ async function createPreset(tree, options) {
|
|
81
83
|
unitTestRunner: options.bundler === 'vite' ? 'vitest' : 'jest',
|
82
84
|
addPlugin,
|
83
85
|
nxCloudToken: options.nxCloudToken,
|
86
|
+
formatter: options.formatter,
|
84
87
|
});
|
85
88
|
}
|
86
89
|
else if (options.preset === presets_1.Preset.RemixMonorepo) {
|
@@ -94,6 +97,8 @@ async function createPreset(tree, options) {
|
|
94
97
|
unitTestRunner: 'vitest',
|
95
98
|
addPlugin,
|
96
99
|
nxCloudToken: options.nxCloudToken,
|
100
|
+
useTsSolution: options.workspaces,
|
101
|
+
formatter: options.formatter,
|
97
102
|
});
|
98
103
|
}
|
99
104
|
else if (options.preset === presets_1.Preset.RemixStandalone) {
|
@@ -108,6 +113,7 @@ async function createPreset(tree, options) {
|
|
108
113
|
unitTestRunner: 'vitest',
|
109
114
|
addPlugin,
|
110
115
|
nxCloudToken: options.nxCloudToken,
|
116
|
+
formatter: options.formatter,
|
111
117
|
});
|
112
118
|
}
|
113
119
|
else if (options.preset === presets_1.Preset.VueMonorepo) {
|
@@ -178,6 +184,8 @@ async function createPreset(tree, options) {
|
|
178
184
|
src: options.nextSrcDir,
|
179
185
|
e2eTestRunner: options.e2eTestRunner ?? 'playwright',
|
180
186
|
addPlugin,
|
187
|
+
useTsSolution: options.workspaces,
|
188
|
+
formatter: options.formatter,
|
181
189
|
});
|
182
190
|
}
|
183
191
|
else if (options.preset === presets_1.Preset.NextJsStandalone) {
|
@@ -193,6 +201,7 @@ async function createPreset(tree, options) {
|
|
193
201
|
e2eTestRunner: options.e2eTestRunner ?? 'playwright',
|
194
202
|
rootProject: true,
|
195
203
|
addPlugin,
|
204
|
+
formatter: options.formatter,
|
196
205
|
});
|
197
206
|
}
|
198
207
|
else if (options.preset === presets_1.Preset.WebComponents) {
|
@@ -241,6 +250,8 @@ async function createPreset(tree, options) {
|
|
241
250
|
addPlugin,
|
242
251
|
nxCloudToken: options.nxCloudToken,
|
243
252
|
bundler: options.bundler ?? 'webpack',
|
253
|
+
useTsSolution: options.workspaces,
|
254
|
+
formatter: options.formatter,
|
244
255
|
});
|
245
256
|
}
|
246
257
|
else if (options.preset === presets_1.Preset.Expo) {
|
@@ -252,6 +263,8 @@ async function createPreset(tree, options) {
|
|
252
263
|
e2eTestRunner: options.e2eTestRunner ?? 'detox',
|
253
264
|
addPlugin,
|
254
265
|
nxCloudToken: options.nxCloudToken,
|
266
|
+
useTsSolution: options.workspaces,
|
267
|
+
formatter: options.formatter,
|
255
268
|
});
|
256
269
|
}
|
257
270
|
else if (options.preset === presets_1.Preset.TS) {
|
@@ -17,7 +17,7 @@
|
|
17
17
|
"linter": {
|
18
18
|
"description": "The tool to use for running lint checks.",
|
19
19
|
"type": "string",
|
20
|
-
"enum": ["eslint"],
|
20
|
+
"enum": ["eslint", "none"],
|
21
21
|
"default": "eslint"
|
22
22
|
},
|
23
23
|
"routing": {
|
@@ -103,6 +103,17 @@
|
|
103
103
|
"prefix": {
|
104
104
|
"description": "The prefix to use for Angular component and directive selectors.",
|
105
105
|
"type": "string"
|
106
|
+
},
|
107
|
+
"formatter": {
|
108
|
+
"description": "The tool to use for code formatting.",
|
109
|
+
"type": "string",
|
110
|
+
"enum": ["none", "prettier"],
|
111
|
+
"default": "none"
|
112
|
+
},
|
113
|
+
"workspaces": {
|
114
|
+
"description": "Whether to use package manager workspaces.",
|
115
|
+
"type": "boolean",
|
116
|
+
"default": false
|
106
117
|
}
|
107
118
|
},
|
108
119
|
"required": ["preset", "name"]
|