@nx/workspace 20.0.0-canary.20240928-f221a41 → 20.0.0-canary.20241002-1d10a19

Sign up to get free protection for your applications and to get access to all the features.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nx/workspace",
3
- "version": "20.0.0-canary.20240928-f221a41",
3
+ "version": "20.0.0-canary.20241002-1d10a19",
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.0.0-canary.20240928-f221a41",
41
+ "@nx/devkit": "20.0.0-canary.20241002-1d10a19",
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.0.0-canary.20240928-f221a41"
46
+ "nx": "20.0.0-canary.20241002-1d10a19"
47
47
  },
48
48
  "publishConfig": {
49
49
  "access": "public"
@@ -45,7 +45,6 @@ async function monorepoGenerator(tree, options) {
45
45
  ? (0, devkit_1.joinPathFragments)(appsDir, project.root === '.' ? project.name : project.root)
46
46
  : (0, devkit_1.joinPathFragments)(libsDir, project.root === '.' ? project.name : project.root),
47
47
  updateImportPath: project.projectType === 'library',
48
- projectNameAndRootFormat: 'as-provided',
49
48
  });
50
49
  }
51
50
  }
@@ -1,5 +1,3 @@
1
- import { ProjectNameAndRootFormat } from '@nx/devkit/src/generators/project-name-and-root-utils';
2
-
3
1
  export interface Schema {
4
2
  projectName: string;
5
3
  destination: string;
@@ -7,7 +5,6 @@ export interface Schema {
7
5
  updateImportPath: boolean;
8
6
  skipFormat?: boolean;
9
7
  newProjectName?: string;
10
- projectNameAndRootFormat?: ProjectNameAndRootFormat;
11
8
  }
12
9
 
13
10
  export interface NormalizedSchema extends Schema {
@@ -33,11 +33,6 @@
33
33
  "index": 0
34
34
  }
35
35
  },
36
- "projectNameAndRootFormat": {
37
- "description": "Whether to generate the new project name and destination as provided (`as-provided`) or generate them composing their values and taking the configured layout into account (`derived`).",
38
- "type": "string",
39
- "enum": ["as-provided", "derived"]
40
- },
41
36
  "importPath": {
42
37
  "type": "string",
43
38
  "description": "The new import path to use in the `tsconfig.base.json`."
@@ -1,8 +1,6 @@
1
1
  import { Tree } from '@nx/devkit';
2
- import { type ProjectNameAndRootFormat } from '@nx/devkit/src/generators/project-name-and-root-utils';
3
2
  export interface ProjectOptions {
4
- name: string;
5
- directory?: string;
6
- projectNameAndRootFormat?: ProjectNameAndRootFormat;
3
+ directory: string;
4
+ name?: string;
7
5
  }
8
6
  export declare function npmPackageGenerator(tree: Tree, _options: ProjectOptions): Promise<void>;
@@ -6,11 +6,11 @@ const project_name_and_root_utils_1 = require("@nx/devkit/src/generators/project
6
6
  const path_1 = require("path");
7
7
  const get_import_path_1 = require("../../utilities/get-import-path");
8
8
  async function normalizeOptions(tree, options) {
9
+ await (0, project_name_and_root_utils_1.ensureProjectName)(tree, options, 'library');
9
10
  const { projectName, projectRoot } = await (0, project_name_and_root_utils_1.determineProjectNameAndRootOptions)(tree, {
10
11
  name: options.name,
11
12
  projectType: 'library',
12
13
  directory: options.directory,
13
- projectNameAndRootFormat: options.projectNameAndRootFormat,
14
14
  });
15
15
  return {
16
16
  ...options,
@@ -6,26 +6,20 @@
6
6
  "cli": "nx",
7
7
  "type": "object",
8
8
  "properties": {
9
- "name": {
9
+ "directory": {
10
10
  "type": "string",
11
- "description": "Package name.",
11
+ "description": "A directory where the package is placed.",
12
+ "alias": "dir",
12
13
  "$default": {
13
14
  "$source": "argv",
14
15
  "index": 0
15
16
  },
16
- "x-prompt": "What name of your npm package?",
17
- "pattern": "(?:^@[a-zA-Z0-9-*~][a-zA-Z0-9-*._~]*\\/[a-zA-Z0-9-~][a-zA-Z0-9-._~]*|^[a-zA-Z][^:]*)$"
18
- },
19
- "directory": {
20
- "type": "string",
21
- "description": "A directory where the package is placed.",
22
- "alias": "dir"
17
+ "x-prompt": "Which directory do you want to create the package in?"
23
18
  },
24
- "projectNameAndRootFormat": {
25
- "description": "Whether to generate the project name and root directory as provided (`as-provided`) or generate them composing their values and taking the configured layout into account (`derived`).",
19
+ "name": {
26
20
  "type": "string",
27
- "enum": ["as-provided", "derived"]
21
+ "description": "Package name."
28
22
  }
29
23
  },
30
- "required": ["name"]
24
+ "required": ["directory"]
31
25
  }
@@ -25,7 +25,6 @@ async function createPreset(tree, options) {
25
25
  return angularApplicationGenerator(tree, {
26
26
  name: options.name,
27
27
  directory: (0, path_1.join)('apps', options.name),
28
- projectNameAndRootFormat: 'as-provided',
29
28
  style: options.style,
30
29
  linter: options.linter,
31
30
  standalone: options.standaloneApi,
@@ -42,7 +41,6 @@ async function createPreset(tree, options) {
42
41
  return angularApplicationGenerator(tree, {
43
42
  name: options.name,
44
43
  directory: '.',
45
- projectNameAndRootFormat: 'as-provided',
46
44
  style: options.style,
47
45
  linter: options.linter,
48
46
  routing: options.routing,
@@ -61,7 +59,6 @@ async function createPreset(tree, options) {
61
59
  return reactApplicationGenerator(tree, {
62
60
  name: options.name,
63
61
  directory: (0, path_1.join)('apps', options.name),
64
- projectNameAndRootFormat: 'as-provided',
65
62
  style: options.style,
66
63
  linter: options.linter,
67
64
  bundler: options.bundler ?? 'webpack',
@@ -76,7 +73,6 @@ async function createPreset(tree, options) {
76
73
  return reactApplicationGenerator(tree, {
77
74
  name: options.name,
78
75
  directory: '.',
79
- projectNameAndRootFormat: 'as-provided',
80
76
  style: options.style,
81
77
  linter: options.linter,
82
78
  rootProject: true,
@@ -93,7 +89,6 @@ async function createPreset(tree, options) {
93
89
  return remixApplicationGenerator(tree, {
94
90
  name: options.name,
95
91
  directory: (0, path_1.join)('apps', options.name),
96
- projectNameAndRootFormat: 'as-provided',
97
92
  linter: options.linter,
98
93
  e2eTestRunner: options.e2eTestRunner ?? 'playwright',
99
94
  unitTestRunner: 'vitest',
@@ -107,7 +102,6 @@ async function createPreset(tree, options) {
107
102
  return remixApplicationGenerator(tree, {
108
103
  name: options.name,
109
104
  directory: '.',
110
- projectNameAndRootFormat: 'as-provided',
111
105
  linter: options.linter,
112
106
  e2eTestRunner: options.e2eTestRunner ?? 'playwright',
113
107
  rootProject: true,
@@ -122,7 +116,6 @@ async function createPreset(tree, options) {
122
116
  return vueApplicationGenerator(tree, {
123
117
  name: options.name,
124
118
  directory: (0, path_1.join)('apps', options.name),
125
- projectNameAndRootFormat: 'as-provided',
126
119
  style: options.style,
127
120
  linter: options.linter,
128
121
  e2eTestRunner: options.e2eTestRunner ?? 'playwright',
@@ -136,7 +129,6 @@ async function createPreset(tree, options) {
136
129
  return vueApplicationGenerator(tree, {
137
130
  name: options.name,
138
131
  directory: '.',
139
- projectNameAndRootFormat: 'as-provided',
140
132
  style: options.style,
141
133
  linter: options.linter,
142
134
  rootProject: true,
@@ -152,7 +144,6 @@ async function createPreset(tree, options) {
152
144
  return nuxtApplicationGenerator(tree, {
153
145
  name: options.name,
154
146
  directory: (0, path_1.join)('apps', options.name),
155
- projectNameAndRootFormat: 'as-provided',
156
147
  style: options.style,
157
148
  linter: options.linter,
158
149
  e2eTestRunner: options.e2eTestRunner ?? 'playwright',
@@ -166,7 +157,6 @@ async function createPreset(tree, options) {
166
157
  return nuxtApplicationGenerator(tree, {
167
158
  name: options.name,
168
159
  directory: '.',
169
- projectNameAndRootFormat: 'as-provided',
170
160
  style: options.style,
171
161
  linter: options.linter,
172
162
  rootProject: true,
@@ -182,7 +172,6 @@ async function createPreset(tree, options) {
182
172
  return nextApplicationGenerator(tree, {
183
173
  name: options.name,
184
174
  directory: (0, path_1.join)('apps', options.name),
185
- projectNameAndRootFormat: 'as-provided',
186
175
  style: options.style,
187
176
  linter: options.linter,
188
177
  appDir: options.nextAppDir,
@@ -197,7 +186,6 @@ async function createPreset(tree, options) {
197
186
  return nextApplicationGenerator(tree, {
198
187
  name: options.name,
199
188
  directory: '.',
200
- projectNameAndRootFormat: 'as-provided',
201
189
  style: options.style,
202
190
  linter: options.linter,
203
191
  appDir: options.nextAppDir,
@@ -213,7 +201,6 @@ async function createPreset(tree, options) {
213
201
  return webApplicationGenerator(tree, {
214
202
  name: options.name,
215
203
  directory: (0, path_1.join)('apps', options.name),
216
- projectNameAndRootFormat: 'as-provided',
217
204
  style: options.style,
218
205
  linter: options.linter,
219
206
  bundler: 'vite',
@@ -228,7 +215,6 @@ async function createPreset(tree, options) {
228
215
  return nestApplicationGenerator(tree, {
229
216
  name: options.name,
230
217
  directory: (0, path_1.join)('apps', options.name),
231
- projectNameAndRootFormat: 'as-provided',
232
218
  linter: options.linter,
233
219
  e2eTestRunner: options.e2eTestRunner ?? 'jest',
234
220
  addPlugin,
@@ -239,7 +225,6 @@ async function createPreset(tree, options) {
239
225
  return expressApplicationGenerator(tree, {
240
226
  name: options.name,
241
227
  directory: (0, path_1.join)('apps', options.name),
242
- projectNameAndRootFormat: 'as-provided',
243
228
  linter: options.linter,
244
229
  e2eTestRunner: options.e2eTestRunner ?? 'jest',
245
230
  addPlugin,
@@ -251,7 +236,6 @@ async function createPreset(tree, options) {
251
236
  return reactNativeApplicationGenerator(tree, {
252
237
  name: options.name,
253
238
  directory: (0, path_1.join)('apps', options.name),
254
- projectNameAndRootFormat: 'as-provided',
255
239
  linter: options.linter,
256
240
  e2eTestRunner: options.e2eTestRunner ?? 'detox',
257
241
  addPlugin,
@@ -263,7 +247,6 @@ async function createPreset(tree, options) {
263
247
  return expoApplicationGenerator(tree, {
264
248
  name: options.name,
265
249
  directory: (0, path_1.join)('apps', options.name),
266
- projectNameAndRootFormat: 'as-provided',
267
250
  linter: options.linter,
268
251
  e2eTestRunner: options.e2eTestRunner ?? 'detox',
269
252
  addPlugin,
@@ -283,7 +266,6 @@ async function createPreset(tree, options) {
283
266
  return libraryGenerator(tree, {
284
267
  name: options.name,
285
268
  directory: '.',
286
- projectNameAndRootFormat: 'as-provided',
287
269
  bundler: 'tsc',
288
270
  unitTestRunner: 'vitest',
289
271
  testEnvironment: 'node',
@@ -300,7 +282,6 @@ async function createPreset(tree, options) {
300
282
  bundler,
301
283
  name: options.name,
302
284
  directory: '.',
303
- projectNameAndRootFormat: 'as-provided',
304
285
  linter: options.linter,
305
286
  standaloneConfig: options.standaloneConfig,
306
287
  framework: options.framework,
@@ -318,7 +299,6 @@ async function createPreset(tree, options) {
318
299
  bundler,
319
300
  name: options.name,
320
301
  directory: (0, path_1.join)('apps', options.name),
321
- projectNameAndRootFormat: 'as-provided',
322
302
  linter: options.linter,
323
303
  framework: options.framework,
324
304
  docker: options.docker,
@@ -119,7 +119,7 @@ async function createNewPlugin(tree) {
119
119
  const importPath = npmScope ? `@${npmScope}/${PROJECT_NAME}` : PROJECT_NAME;
120
120
  await pluginGenerator(tree, {
121
121
  minimal: true,
122
- name: PROJECT_NAME,
122
+ directory: PROJECT_NAME,
123
123
  importPath: importPath,
124
124
  skipTsConfig: false,
125
125
  compiler: 'tsc',
@@ -142,7 +142,6 @@ function moveGeneratedPlugin(tree, destination, importPath) {
142
142
  newProjectName: PROJECT_NAME,
143
143
  updateImportPath: true,
144
144
  importPath: importPath,
145
- projectNameAndRootFormat: 'as-provided',
146
145
  });
147
146
  }
148
147
  }