@nx/node 20.0.0-canary.20241001-8fa7065 → 20.0.0-canary.20241003-84a5c7a
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/migrations.json +1 -26
- package/package.json +5 -5
- package/src/generators/application/application.js +4 -4
- package/src/generators/application/schema.d.ts +2 -4
- package/src/generators/application/schema.json +7 -13
- package/src/generators/e2e-project/e2e-project.js +2 -4
- package/src/generators/e2e-project/schema.d.ts +0 -3
- package/src/generators/e2e-project/schema.json +0 -5
- package/src/generators/init/init.js +2 -0
- package/src/generators/library/library.js +5 -4
- package/src/generators/library/schema.d.ts +2 -4
- package/src/generators/library/schema.json +9 -14
- package/src/migrations/update-16-0-0/update-webpack-executor.d.ts +0 -2
- package/src/migrations/update-16-0-0/update-webpack-executor.js +0 -17
- package/src/migrations/update-16-0-0-add-nx-packages/update-16-0-0-add-nx-packages.d.ts +0 -2
- package/src/migrations/update-16-0-0-add-nx-packages/update-16-0-0-add-nx-packages.js +0 -9
- package/src/migrations/update-16-3-1/update-webpack-executor.d.ts +0 -2
- package/src/migrations/update-16-3-1/update-webpack-executor.js +0 -17
- package/src/migrations/update-16-4-0/replace-node-executor.d.ts +0 -2
- package/src/migrations/update-16-4-0/replace-node-executor.js +0 -14
package/migrations.json
CHANGED
@@ -1,30 +1,5 @@
|
|
1
1
|
{
|
2
|
-
"generators": {
|
3
|
-
"update-16-0-0-add-nx-packages": {
|
4
|
-
"cli": "nx",
|
5
|
-
"version": "16.0.0-beta.1",
|
6
|
-
"description": "Replace @nrwl/node with @nx/node",
|
7
|
-
"implementation": "./src/migrations/update-16-0-0-add-nx-packages/update-16-0-0-add-nx-packages"
|
8
|
-
},
|
9
|
-
"update-16-0-0-update-executor": {
|
10
|
-
"cli": "nx",
|
11
|
-
"version": "16.0.0-beta.5",
|
12
|
-
"description": "Replace @nrwl/node:webpack with @nx/node:webpack",
|
13
|
-
"implementation": "./src/migrations/update-16-0-0/update-webpack-executor"
|
14
|
-
},
|
15
|
-
"update-16-3-1-update-executor": {
|
16
|
-
"cli": "nx",
|
17
|
-
"version": "16.3.1-beta.0",
|
18
|
-
"description": "Replace @nrwl/node:webpack and @nx/node:webpack with @nx/webpack:webpack for all project targets",
|
19
|
-
"implementation": "./src/migrations/update-16-3-1/update-webpack-executor"
|
20
|
-
},
|
21
|
-
"update-16-4-0-replace-node-executor": {
|
22
|
-
"cli": "nx",
|
23
|
-
"version": "16.4.0-beta.8",
|
24
|
-
"description": "Replace @nx/node:node with @nx/js:node for all project targets",
|
25
|
-
"implementation": "./src/migrations/update-16-4-0/replace-node-executor"
|
26
|
-
}
|
27
|
-
},
|
2
|
+
"generators": {},
|
28
3
|
"packageJsonUpdates": {
|
29
4
|
"17.3.0": {
|
30
5
|
"version": "17.3.0-beta.3",
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@nx/node",
|
3
|
-
"version": "20.0.0-canary.
|
3
|
+
"version": "20.0.0-canary.20241003-84a5c7a",
|
4
4
|
"private": false,
|
5
5
|
"description": "The Node Plugin for Nx contains generators to manage Node applications within an Nx workspace.",
|
6
6
|
"repository": {
|
@@ -32,10 +32,10 @@
|
|
32
32
|
},
|
33
33
|
"dependencies": {
|
34
34
|
"tslib": "^2.3.0",
|
35
|
-
"@nx/devkit": "20.0.0-canary.
|
36
|
-
"@nx/jest": "20.0.0-canary.
|
37
|
-
"@nx/js": "20.0.0-canary.
|
38
|
-
"@nx/eslint": "20.0.0-canary.
|
35
|
+
"@nx/devkit": "20.0.0-canary.20241003-84a5c7a",
|
36
|
+
"@nx/jest": "20.0.0-canary.20241003-84a5c7a",
|
37
|
+
"@nx/js": "20.0.0-canary.20241003-84a5c7a",
|
38
|
+
"@nx/eslint": "20.0.0-canary.20241003-84a5c7a"
|
39
39
|
},
|
40
40
|
"publishConfig": {
|
41
41
|
"access": "public"
|
@@ -7,6 +7,7 @@ const devkit_1 = require("@nx/devkit");
|
|
7
7
|
const project_name_and_root_utils_1 = require("@nx/devkit/src/generators/project-name-and-root-utils");
|
8
8
|
const jest_1 = require("@nx/jest");
|
9
9
|
const js_1 = require("@nx/js");
|
10
|
+
const ts_solution_setup_1 = require("@nx/js/src/utils/typescript/ts-solution-setup");
|
10
11
|
const versions_1 = require("@nx/js/src/utils/versions");
|
11
12
|
const eslint_1 = require("@nx/eslint");
|
12
13
|
const path_1 = require("path");
|
@@ -276,6 +277,7 @@ async function applicationGenerator(tree, schema) {
|
|
276
277
|
});
|
277
278
|
}
|
278
279
|
async function applicationGeneratorInternal(tree, schema) {
|
280
|
+
(0, ts_solution_setup_1.assertNotUsingTsSolutionSetup)(tree, 'node', 'application');
|
279
281
|
const options = await normalizeOptions(tree, schema);
|
280
282
|
const tasks = [];
|
281
283
|
if (options.framework === 'nest') {
|
@@ -359,7 +361,6 @@ async function applicationGeneratorInternal(tree, schema) {
|
|
359
361
|
projectType: options.framework === 'none' ? 'cli' : 'server',
|
360
362
|
name: options.rootProject ? 'e2e' : `${options.name}-e2e`,
|
361
363
|
directory: options.rootProject ? 'e2e' : `${options.appProjectRoot}-e2e`,
|
362
|
-
projectNameAndRootFormat: 'as-provided',
|
363
364
|
project: options.name,
|
364
365
|
port: options.port,
|
365
366
|
isNest: options.isNest,
|
@@ -390,15 +391,14 @@ async function applicationGeneratorInternal(tree, schema) {
|
|
390
391
|
return (0, devkit_1.runTasksInSerial)(...tasks);
|
391
392
|
}
|
392
393
|
async function normalizeOptions(host, options) {
|
393
|
-
|
394
|
+
await (0, project_name_and_root_utils_1.ensureProjectName)(host, options, 'application');
|
395
|
+
const { projectName: appProjectName, projectRoot: appProjectRoot } = await (0, project_name_and_root_utils_1.determineProjectNameAndRootOptions)(host, {
|
394
396
|
name: options.name,
|
395
397
|
projectType: 'application',
|
396
398
|
directory: options.directory,
|
397
|
-
projectNameAndRootFormat: options.projectNameAndRootFormat,
|
398
399
|
rootProject: options.rootProject,
|
399
400
|
});
|
400
401
|
options.rootProject = appProjectRoot === '.';
|
401
|
-
options.projectNameAndRootFormat = projectNameAndRootFormat;
|
402
402
|
options.bundler = options.bundler ?? 'esbuild';
|
403
403
|
options.e2eTestRunner = options.e2eTestRunner ?? 'jest';
|
404
404
|
const parsedTags = options.tags
|
@@ -1,12 +1,10 @@
|
|
1
|
-
import type { ProjectNameAndRootFormat } from '@nx/devkit/src/generators/project-name-and-root-utils';
|
2
1
|
import type { Linter, LinterType } from '@nx/eslint';
|
3
2
|
|
4
3
|
export interface Schema {
|
5
|
-
|
4
|
+
directory: string;
|
5
|
+
name?: string;
|
6
6
|
skipFormat?: boolean;
|
7
7
|
skipPackageJson?: boolean;
|
8
|
-
directory?: string;
|
9
|
-
projectNameAndRootFormat?: ProjectNameAndRootFormat;
|
10
8
|
unitTestRunner?: 'jest' | 'none';
|
11
9
|
e2eTestRunner?: 'jest' | 'none';
|
12
10
|
linter?: Linter | LinterType;
|
@@ -6,27 +6,21 @@
|
|
6
6
|
"description": "Nx Application Options Schema.",
|
7
7
|
"type": "object",
|
8
8
|
"properties": {
|
9
|
-
"
|
10
|
-
"description": "The
|
9
|
+
"directory": {
|
10
|
+
"description": "The directory of the new application.",
|
11
11
|
"type": "string",
|
12
12
|
"$default": {
|
13
13
|
"$source": "argv",
|
14
14
|
"index": 0
|
15
15
|
},
|
16
|
-
"x-prompt": "
|
17
|
-
"x-priority": "important",
|
18
|
-
"pattern": "^[a-zA-Z][^:]*$"
|
16
|
+
"x-prompt": "Which directory do you want to create the application in?"
|
19
17
|
},
|
20
|
-
"
|
21
|
-
"description": "The
|
18
|
+
"name": {
|
19
|
+
"description": "The name of the application.",
|
22
20
|
"type": "string",
|
21
|
+
"pattern": "^[a-zA-Z][^:]*$",
|
23
22
|
"x-priority": "important"
|
24
23
|
},
|
25
|
-
"projectNameAndRootFormat": {
|
26
|
-
"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`).",
|
27
|
-
"type": "string",
|
28
|
-
"enum": ["as-provided", "derived"]
|
29
|
-
},
|
30
24
|
"skipFormat": {
|
31
25
|
"description": "Skip formatting files",
|
32
26
|
"type": "boolean",
|
@@ -126,5 +120,5 @@
|
|
126
120
|
"description": "Add a docker build target"
|
127
121
|
}
|
128
122
|
},
|
129
|
-
"required": ["
|
123
|
+
"required": ["directory"]
|
130
124
|
}
|
@@ -126,13 +126,11 @@ async function e2eProjectGeneratorInternal(host, _options) {
|
|
126
126
|
return (0, devkit_1.runTasksInSerial)(...tasks);
|
127
127
|
}
|
128
128
|
async function normalizeOptions(tree, options) {
|
129
|
+
options.directory = options.directory ?? `${options.project}-e2e`;
|
129
130
|
const { projectName: e2eProjectName, projectRoot: e2eProjectRoot } = await (0, project_name_and_root_utils_1.determineProjectNameAndRootOptions)(tree, {
|
130
|
-
name: options.name
|
131
|
+
name: options.name,
|
131
132
|
projectType: 'library',
|
132
133
|
directory: options.rootProject ? 'e2e' : options.directory,
|
133
|
-
projectNameAndRootFormat: options.rootProject
|
134
|
-
? 'as-provided'
|
135
|
-
: options.projectNameAndRootFormat,
|
136
134
|
});
|
137
135
|
const nxJson = (0, devkit_1.readNxJson)(tree);
|
138
136
|
const addPlugin = process.env.NX_ADD_PLUGINS !== 'false' &&
|
@@ -1,10 +1,7 @@
|
|
1
|
-
import type { ProjectNameAndRootFormat } from '@nx/devkit/src/generators/project-name-and-root-utils';
|
2
|
-
|
3
1
|
export interface Schema {
|
4
2
|
project: string;
|
5
3
|
projectType: 'server' | 'cli';
|
6
4
|
directory?: string;
|
7
|
-
projectNameAndRootFormat?: ProjectNameAndRootFormat;
|
8
5
|
name?: string;
|
9
6
|
port?: number;
|
10
7
|
linter?: 'eslint' | 'none';
|
@@ -18,11 +18,6 @@
|
|
18
18
|
"type": "string",
|
19
19
|
"x-priority": "important"
|
20
20
|
},
|
21
|
-
"projectNameAndRootFormat": {
|
22
|
-
"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`).",
|
23
|
-
"type": "string",
|
24
|
-
"enum": ["as-provided", "derived"]
|
25
|
-
},
|
26
21
|
"name": {
|
27
22
|
"description": "The name of the e2e project. Defaults to the project name with '-e2e' suffix.",
|
28
23
|
"type": "string"
|
@@ -2,6 +2,7 @@
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.initGenerator = initGenerator;
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
5
|
+
const ts_solution_setup_1 = require("@nx/js/src/utils/typescript/ts-solution-setup");
|
5
6
|
const versions_1 = require("../../utils/versions");
|
6
7
|
function updateDependencies(tree, options) {
|
7
8
|
const tasks = [];
|
@@ -10,6 +11,7 @@ function updateDependencies(tree, options) {
|
|
10
11
|
return (0, devkit_1.runTasksInSerial)(...tasks);
|
11
12
|
}
|
12
13
|
async function initGenerator(tree, options) {
|
14
|
+
(0, ts_solution_setup_1.assertNotUsingTsSolutionSetup)(tree, 'node', 'init');
|
13
15
|
let installTask = () => { };
|
14
16
|
if (!options.skipPackageJson) {
|
15
17
|
installTask = updateDependencies(tree, options);
|
@@ -7,6 +7,7 @@ const project_name_and_root_utils_1 = require("@nx/devkit/src/generators/project
|
|
7
7
|
const js_1 = require("@nx/js");
|
8
8
|
const add_swc_config_1 = require("@nx/js/src/utils/swc/add-swc-config");
|
9
9
|
const add_swc_dependencies_1 = require("@nx/js/src/utils/swc/add-swc-dependencies");
|
10
|
+
const ts_solution_setup_1 = require("@nx/js/src/utils/typescript/ts-solution-setup");
|
10
11
|
const path_1 = require("path");
|
11
12
|
const versions_1 = require("../../utils/versions");
|
12
13
|
const init_1 = require("../init/init");
|
@@ -18,6 +19,7 @@ async function libraryGenerator(tree, schema) {
|
|
18
19
|
});
|
19
20
|
}
|
20
21
|
async function libraryGeneratorInternal(tree, schema) {
|
22
|
+
(0, ts_solution_setup_1.assertNotUsingTsSolutionSetup)(tree, 'node', 'library');
|
21
23
|
const options = await normalizeOptions(tree, schema);
|
22
24
|
const tasks = [
|
23
25
|
await (0, init_1.initGenerator)(tree, {
|
@@ -30,7 +32,7 @@ async function libraryGeneratorInternal(tree, schema) {
|
|
30
32
|
}
|
31
33
|
const libraryInstall = await (0, js_1.libraryGenerator)(tree, {
|
32
34
|
...options,
|
33
|
-
bundler: schema.buildable ? 'tsc' : 'none',
|
35
|
+
bundler: schema.buildable || schema.publishable ? 'tsc' : 'none',
|
34
36
|
includeBabelRc: schema.babelJest,
|
35
37
|
importPath: options.importPath,
|
36
38
|
testEnvironment: 'node',
|
@@ -51,14 +53,13 @@ async function libraryGeneratorInternal(tree, schema) {
|
|
51
53
|
}
|
52
54
|
exports.default = libraryGenerator;
|
53
55
|
async function normalizeOptions(tree, options) {
|
54
|
-
|
56
|
+
await (0, project_name_and_root_utils_1.ensureProjectName)(tree, options, 'library');
|
57
|
+
const { projectName, names: projectNames, projectRoot, importPath, } = await (0, project_name_and_root_utils_1.determineProjectNameAndRootOptions)(tree, {
|
55
58
|
name: options.name,
|
56
59
|
projectType: 'library',
|
57
60
|
directory: options.directory,
|
58
61
|
importPath: options.importPath,
|
59
|
-
projectNameAndRootFormat: options.projectNameAndRootFormat,
|
60
62
|
});
|
61
|
-
options.projectNameAndRootFormat = projectNameAndRootFormat;
|
62
63
|
const nxJson = (0, devkit_1.readNxJson)(tree);
|
63
64
|
const addPluginDefault = process.env.NX_ADD_PLUGINS !== 'false' &&
|
64
65
|
nxJson.useInferencePlugins !== false;
|
@@ -1,10 +1,8 @@
|
|
1
|
-
import type { ProjectNameAndRootFormat } from '@nx/devkit/src/generators/project-name-and-root-utils';
|
2
1
|
import type { Linter, LinterType } from '@nx/eslint';
|
3
2
|
|
4
3
|
export interface Schema {
|
5
|
-
|
6
|
-
|
7
|
-
projectNameAndRootFormat?: ProjectNameAndRootFormat;
|
4
|
+
directory: string;
|
5
|
+
name?: string;
|
8
6
|
simpleModuleName?: boolean;
|
9
7
|
skipTsConfig?: boolean;
|
10
8
|
skipFormat?: boolean;
|
@@ -12,29 +12,24 @@
|
|
12
12
|
}
|
13
13
|
],
|
14
14
|
"properties": {
|
15
|
-
"
|
15
|
+
"directory": {
|
16
16
|
"type": "string",
|
17
|
-
"description": "
|
17
|
+
"description": "A directory where the lib is placed",
|
18
|
+
"alias": "dir",
|
18
19
|
"$default": {
|
19
20
|
"$source": "argv",
|
20
21
|
"index": 0
|
21
22
|
},
|
22
|
-
"x-prompt": "
|
23
|
-
"pattern": "(?:^@[a-zA-Z0-9-*~][a-zA-Z0-9-*._~]*\\/[a-zA-Z0-9-~][a-zA-Z0-9-._~]*|^[a-zA-Z][^:]*)$"
|
23
|
+
"x-prompt": "Which directory do you want to create the library in?"
|
24
24
|
},
|
25
|
-
"
|
25
|
+
"name": {
|
26
26
|
"type": "string",
|
27
|
-
"description": "
|
28
|
-
"
|
27
|
+
"description": "Library name",
|
28
|
+
"pattern": "(?:^@[a-zA-Z0-9-*~][a-zA-Z0-9-*._~]*\\/[a-zA-Z0-9-~][a-zA-Z0-9-._~]*|^[a-zA-Z][^:]*)$",
|
29
29
|
"x-priority": "important"
|
30
30
|
},
|
31
|
-
"projectNameAndRootFormat": {
|
32
|
-
"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`).",
|
33
|
-
"type": "string",
|
34
|
-
"enum": ["as-provided", "derived"]
|
35
|
-
},
|
36
31
|
"simpleModuleName": {
|
37
|
-
"description": "Keep the module name simple
|
32
|
+
"description": "Keep the module name simple.",
|
38
33
|
"type": "boolean",
|
39
34
|
"default": false
|
40
35
|
},
|
@@ -126,5 +121,5 @@
|
|
126
121
|
"default": false
|
127
122
|
}
|
128
123
|
},
|
129
|
-
"required": ["
|
124
|
+
"required": ["directory"]
|
130
125
|
}
|
@@ -1,17 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.default = update;
|
4
|
-
const devkit_1 = require("@nx/devkit");
|
5
|
-
const executor_options_utils_1 = require("@nx/devkit/src/generators/executor-options-utils");
|
6
|
-
async function update(tree) {
|
7
|
-
const migrateProject = (options, projectName, targetName) => {
|
8
|
-
const projectConfig = (0, devkit_1.readProjectConfiguration)(tree, projectName);
|
9
|
-
projectConfig.targets[targetName].executor = '@nx/webpack:webpack';
|
10
|
-
projectConfig.targets[targetName].options.compiler = 'tsc';
|
11
|
-
projectConfig.targets[targetName].options.target = 'node';
|
12
|
-
(0, devkit_1.updateProjectConfiguration)(tree, projectName, projectConfig);
|
13
|
-
};
|
14
|
-
(0, executor_options_utils_1.forEachExecutorOptions)(tree, '@nx/node:webpack', migrateProject);
|
15
|
-
(0, executor_options_utils_1.forEachExecutorOptions)(tree, '@nrwl/node:webpack', migrateProject);
|
16
|
-
await (0, devkit_1.formatFiles)(tree);
|
17
|
-
}
|
@@ -1,9 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.default = replacePackage;
|
4
|
-
const devkit_1 = require("@nx/devkit");
|
5
|
-
const replace_package_1 = require("@nx/devkit/src/utils/replace-package");
|
6
|
-
async function replacePackage(tree) {
|
7
|
-
await (0, replace_package_1.replaceNrwlPackageWithNxPackage)(tree, '@nrwl/node', '@nx/node');
|
8
|
-
await (0, devkit_1.formatFiles)(tree);
|
9
|
-
}
|
@@ -1,17 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.default = update;
|
4
|
-
const devkit_1 = require("@nx/devkit");
|
5
|
-
const executor_options_utils_1 = require("@nx/devkit/src/generators/executor-options-utils");
|
6
|
-
async function update(tree) {
|
7
|
-
const migrateProject = (options, projectName, targetName) => {
|
8
|
-
const projectConfig = (0, devkit_1.readProjectConfiguration)(tree, projectName);
|
9
|
-
projectConfig.targets[targetName].executor = '@nx/webpack:webpack';
|
10
|
-
projectConfig.targets[targetName].options.compiler = 'tsc';
|
11
|
-
projectConfig.targets[targetName].options.target = 'node';
|
12
|
-
(0, devkit_1.updateProjectConfiguration)(tree, projectName, projectConfig);
|
13
|
-
};
|
14
|
-
(0, executor_options_utils_1.forEachExecutorOptions)(tree, '@nx/node:webpack', migrateProject);
|
15
|
-
(0, executor_options_utils_1.forEachExecutorOptions)(tree, '@nrwl/node:webpack', migrateProject);
|
16
|
-
await (0, devkit_1.formatFiles)(tree);
|
17
|
-
}
|
@@ -1,14 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.default = update;
|
4
|
-
const devkit_1 = require("@nx/devkit");
|
5
|
-
const executor_options_utils_1 = require("@nx/devkit/src/generators/executor-options-utils");
|
6
|
-
async function update(tree) {
|
7
|
-
const migrateProject = (_options, projectName, targetName) => {
|
8
|
-
const projectConfig = (0, devkit_1.readProjectConfiguration)(tree, projectName);
|
9
|
-
projectConfig.targets[targetName].executor = '@nx/js:node';
|
10
|
-
(0, devkit_1.updateProjectConfiguration)(tree, projectName, projectConfig);
|
11
|
-
};
|
12
|
-
(0, executor_options_utils_1.forEachExecutorOptions)(tree, '@nx/node:node', migrateProject);
|
13
|
-
await (0, devkit_1.formatFiles)(tree);
|
14
|
-
}
|