@nx/node 23.0.0-beta.12 → 23.0.0-beta.13
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 +7 -7
- package/src/generators/application/application.js +5 -6
- package/src/generators/application/lib/add-dependencies.js +15 -15
- package/src/generators/application/lib/create-project.js +3 -3
- package/src/generators/application/lib/create-targets.js +3 -3
- package/src/generators/application/lib/normalize-options.js +2 -2
- package/src/generators/e2e-project/e2e-project.js +4 -5
- package/src/generators/library/library.d.ts.map +1 -1
- package/src/generators/library/library.js +7 -10
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nx/node",
|
|
3
|
-
"version": "23.0.0-beta.
|
|
3
|
+
"version": "23.0.0-beta.13",
|
|
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": {
|
|
@@ -33,16 +33,16 @@
|
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
35
|
"tslib": "^2.3.0",
|
|
36
|
-
"@nx/devkit": "23.0.0-beta.
|
|
37
|
-
"@nx/jest": "23.0.0-beta.
|
|
38
|
-
"@nx/js": "23.0.0-beta.
|
|
39
|
-
"@nx/eslint": "23.0.0-beta.
|
|
40
|
-
"@nx/docker": "23.0.0-beta.
|
|
36
|
+
"@nx/devkit": "23.0.0-beta.13",
|
|
37
|
+
"@nx/jest": "23.0.0-beta.13",
|
|
38
|
+
"@nx/js": "23.0.0-beta.13",
|
|
39
|
+
"@nx/eslint": "23.0.0-beta.13",
|
|
40
|
+
"@nx/docker": "23.0.0-beta.13",
|
|
41
41
|
"tcp-port-used": "^1.0.2",
|
|
42
42
|
"kill-port": "^1.6.1"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
|
-
"nx": "23.0.0-beta.
|
|
45
|
+
"nx": "23.0.0-beta.13"
|
|
46
46
|
},
|
|
47
47
|
"publishConfig": {
|
|
48
48
|
"access": "public"
|
|
@@ -39,8 +39,7 @@ const internal_1 = require("@nx/devkit/internal");
|
|
|
39
39
|
const devkit_1 = require("@nx/devkit");
|
|
40
40
|
const jest_1 = require("@nx/jest");
|
|
41
41
|
const js_1 = require("@nx/js");
|
|
42
|
-
const
|
|
43
|
-
const sort_fields_1 = require("@nx/js/src/utils/package-json/sort-fields");
|
|
42
|
+
const internal_2 = require("@nx/js/internal");
|
|
44
43
|
const versions_1 = require("../../utils/versions");
|
|
45
44
|
const e2e_project_1 = require("../e2e-project/e2e-project");
|
|
46
45
|
const init_1 = require("../init/init");
|
|
@@ -83,7 +82,7 @@ async function applicationGenerator(tree, schema) {
|
|
|
83
82
|
}
|
|
84
83
|
async function applicationGeneratorInternal(tree, schema) {
|
|
85
84
|
const tasks = [];
|
|
86
|
-
const addTsPlugin = (0,
|
|
85
|
+
const addTsPlugin = (0, internal_2.shouldConfigureTsSolutionSetup)(tree, schema.addPlugin, schema.useTsSolution);
|
|
87
86
|
const jsInitTask = await (0, js_1.initGenerator)(tree, {
|
|
88
87
|
...schema,
|
|
89
88
|
tsConfigName: schema.rootProject ? 'tsconfig.json' : 'tsconfig.base.json',
|
|
@@ -142,7 +141,7 @@ async function applicationGeneratorInternal(tree, schema) {
|
|
|
142
141
|
// If we are using the new TS solution
|
|
143
142
|
// We need to update the workspace file (package.json or pnpm-workspaces.yaml) to include the new project
|
|
144
143
|
if (options.isUsingTsSolutionConfig) {
|
|
145
|
-
await (0,
|
|
144
|
+
await (0, internal_2.addProjectToTsSolutionWorkspace)(tree, options.appProjectRoot);
|
|
146
145
|
}
|
|
147
146
|
updateTsConfigOptions(tree, options);
|
|
148
147
|
if (options.linter === 'eslint') {
|
|
@@ -206,14 +205,14 @@ async function applicationGeneratorInternal(tree, schema) {
|
|
|
206
205
|
tasks.push(dockerTask);
|
|
207
206
|
}
|
|
208
207
|
if (options.isUsingTsSolutionConfig) {
|
|
209
|
-
(0,
|
|
208
|
+
(0, internal_2.updateTsconfigFiles)(tree, options.appProjectRoot, 'tsconfig.app.json', {
|
|
210
209
|
module: 'nodenext',
|
|
211
210
|
moduleResolution: 'nodenext',
|
|
212
211
|
}, options.linter === 'eslint'
|
|
213
212
|
? ['eslint.config.js', 'eslint.config.cjs', 'eslint.config.mjs']
|
|
214
213
|
: undefined);
|
|
215
214
|
}
|
|
216
|
-
(0,
|
|
215
|
+
(0, internal_2.sortPackageJsonFields)(tree, options.appProjectRoot);
|
|
217
216
|
if (!options.skipFormat) {
|
|
218
217
|
await (0, devkit_1.formatFiles)(tree);
|
|
219
218
|
}
|
|
@@ -2,49 +2,49 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.addProjectDependencies = addProjectDependencies;
|
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
|
5
|
-
const
|
|
6
|
-
const
|
|
5
|
+
const internal_1 = require("@nx/js/internal");
|
|
6
|
+
const versions_1 = require("../../../utils/versions");
|
|
7
7
|
function addProjectDependencies(tree, options) {
|
|
8
8
|
const bundlers = {
|
|
9
9
|
webpack: {
|
|
10
|
-
'@nx/webpack':
|
|
10
|
+
'@nx/webpack': versions_1.nxVersion,
|
|
11
11
|
},
|
|
12
12
|
esbuild: {
|
|
13
|
-
'@nx/esbuild':
|
|
14
|
-
esbuild: (0, devkit_1.getDependencyVersionFromPackageJson)(tree, 'esbuild') ??
|
|
13
|
+
'@nx/esbuild': versions_1.nxVersion,
|
|
14
|
+
esbuild: (0, devkit_1.getDependencyVersionFromPackageJson)(tree, 'esbuild') ?? internal_1.esbuildVersion,
|
|
15
15
|
},
|
|
16
16
|
};
|
|
17
17
|
const frameworkDependencies = {
|
|
18
18
|
express: {
|
|
19
|
-
express:
|
|
19
|
+
express: versions_1.expressVersion,
|
|
20
20
|
},
|
|
21
21
|
koa: {
|
|
22
|
-
koa:
|
|
22
|
+
koa: versions_1.koaVersion,
|
|
23
23
|
},
|
|
24
24
|
fastify: {
|
|
25
|
-
fastify:
|
|
26
|
-
'fastify-plugin':
|
|
27
|
-
'@fastify/autoload':
|
|
28
|
-
'@fastify/sensible':
|
|
25
|
+
fastify: versions_1.fastifyVersion,
|
|
26
|
+
'fastify-plugin': versions_1.fastifyPluginVersion,
|
|
27
|
+
'@fastify/autoload': versions_1.fastifyAutoloadVersion,
|
|
28
|
+
'@fastify/sensible': versions_1.fastifySensibleVersion,
|
|
29
29
|
},
|
|
30
30
|
};
|
|
31
31
|
const frameworkDevDependencies = {
|
|
32
32
|
express: {
|
|
33
|
-
'@types/express':
|
|
33
|
+
'@types/express': versions_1.expressTypingsVersion,
|
|
34
34
|
},
|
|
35
35
|
koa: {
|
|
36
|
-
'@types/koa':
|
|
36
|
+
'@types/koa': versions_1.koaTypingsVersion,
|
|
37
37
|
},
|
|
38
38
|
fastify: {},
|
|
39
39
|
};
|
|
40
40
|
return {
|
|
41
41
|
installTask: (0, devkit_1.addDependenciesToPackageJson)(tree, {
|
|
42
42
|
...frameworkDependencies[options.framework],
|
|
43
|
-
tslib:
|
|
43
|
+
tslib: versions_1.tslibVersion,
|
|
44
44
|
}, {
|
|
45
45
|
...frameworkDevDependencies[options.framework],
|
|
46
46
|
...bundlers[options.bundler],
|
|
47
|
-
'@types/node':
|
|
47
|
+
'@types/node': versions_1.typesNodeVersion,
|
|
48
48
|
}),
|
|
49
49
|
frameworkDependencies: frameworkDependencies[options.framework],
|
|
50
50
|
};
|
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.addProject = addProject;
|
|
4
4
|
const internal_1 = require("@nx/devkit/internal");
|
|
5
5
|
const devkit_1 = require("@nx/devkit");
|
|
6
|
-
const
|
|
6
|
+
const internal_2 = require("@nx/js/internal");
|
|
7
7
|
const has_webpack_plugin_1 = require("../../../utils/has-webpack-plugin");
|
|
8
8
|
const create_targets_1 = require("./create-targets");
|
|
9
9
|
function addProject(tree, options, frameworkDependencies) {
|
|
@@ -16,14 +16,14 @@ function addProject(tree, options, frameworkDependencies) {
|
|
|
16
16
|
};
|
|
17
17
|
if (options.bundler === 'esbuild') {
|
|
18
18
|
(0, internal_1.addBuildTargetDefaults)(tree, '@nx/esbuild:esbuild', 'build', [
|
|
19
|
-
|
|
19
|
+
internal_2.TS_SOLUTION_SETUP_TSCONFIG_INPUT,
|
|
20
20
|
]);
|
|
21
21
|
project.targets.build = (0, create_targets_1.getEsBuildConfig)(tree, project, options);
|
|
22
22
|
}
|
|
23
23
|
else if (options.bundler === 'webpack') {
|
|
24
24
|
if (!(0, has_webpack_plugin_1.hasWebpackPlugin)(tree) && options.addPlugin === false) {
|
|
25
25
|
(0, internal_1.addBuildTargetDefaults)(tree, `@nx/webpack:webpack`, 'build', [
|
|
26
|
-
|
|
26
|
+
internal_2.TS_SOLUTION_SETUP_TSCONFIG_INPUT,
|
|
27
27
|
]);
|
|
28
28
|
project.targets.build = (0, create_targets_1.getWebpackBuildConfig)(tree, project, options);
|
|
29
29
|
}
|
|
@@ -6,10 +6,10 @@ exports.getServeConfig = getServeConfig;
|
|
|
6
6
|
exports.getNestWebpackBuildConfig = getNestWebpackBuildConfig;
|
|
7
7
|
exports.getPruneTargets = getPruneTargets;
|
|
8
8
|
const devkit_1 = require("@nx/devkit");
|
|
9
|
-
const
|
|
9
|
+
const internal_1 = require("@nx/js/internal");
|
|
10
10
|
const js_1 = require("@nx/js");
|
|
11
11
|
function getWebpackBuildConfig(tree, project, options) {
|
|
12
|
-
const sourceRoot = (0,
|
|
12
|
+
const sourceRoot = (0, internal_1.getProjectSourceRoot)(project, tree);
|
|
13
13
|
return {
|
|
14
14
|
executor: `@nx/webpack:webpack`,
|
|
15
15
|
outputs: ['{options.outputPath}'],
|
|
@@ -35,7 +35,7 @@ function getWebpackBuildConfig(tree, project, options) {
|
|
|
35
35
|
};
|
|
36
36
|
}
|
|
37
37
|
function getEsBuildConfig(tree, project, options) {
|
|
38
|
-
const sourceRoot = (0,
|
|
38
|
+
const sourceRoot = (0, internal_1.getProjectSourceRoot)(project, tree);
|
|
39
39
|
return {
|
|
40
40
|
executor: '@nx/esbuild:esbuild',
|
|
41
41
|
outputs: ['{options.outputPath}'],
|
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.normalizeOptions = normalizeOptions;
|
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
|
5
5
|
const internal_1 = require("@nx/devkit/internal");
|
|
6
|
-
const
|
|
6
|
+
const internal_2 = require("@nx/js/internal");
|
|
7
7
|
async function normalizeOptions(host, options) {
|
|
8
8
|
await (0, internal_1.ensureRootProjectName)(options, 'application');
|
|
9
9
|
const { projectName, projectRoot: appProjectRoot, importPath, } = await (0, internal_1.determineProjectNameAndRootOptions)(host, {
|
|
@@ -22,7 +22,7 @@ async function normalizeOptions(host, options) {
|
|
|
22
22
|
const addPlugin = options.addPlugin ??
|
|
23
23
|
(process.env.NX_ADD_PLUGINS !== 'false' &&
|
|
24
24
|
nxJson.useInferencePlugins !== false);
|
|
25
|
-
const isUsingTsSolutionConfig = (0,
|
|
25
|
+
const isUsingTsSolutionConfig = (0, internal_2.isUsingTsSolutionSetup)(host);
|
|
26
26
|
const swcJest = options.swcJest ?? isUsingTsSolutionConfig;
|
|
27
27
|
const appProjectName = !isUsingTsSolutionConfig || options.name ? projectName : importPath;
|
|
28
28
|
const useProjectJson = options.useProjectJson ?? !isUsingTsSolutionConfig;
|
|
@@ -12,9 +12,8 @@ const versions_1 = require("../../utils/versions");
|
|
|
12
12
|
const eslint_file_1 = require("@nx/eslint/src/generators/utils/eslint-file");
|
|
13
13
|
const config_file_1 = require("@nx/jest/src/utils/config/config-file");
|
|
14
14
|
const versions_2 = require("@nx/jest/src/utils/versions");
|
|
15
|
-
const
|
|
15
|
+
const internal_2 = require("@nx/js/internal");
|
|
16
16
|
const posix_1 = require("node:path/posix");
|
|
17
|
-
const add_swc_config_1 = require("@nx/js/src/utils/swc/add-swc-config");
|
|
18
17
|
async function e2eProjectGenerator(host, options) {
|
|
19
18
|
return await e2eProjectGeneratorInternal(host, {
|
|
20
19
|
addPlugin: false,
|
|
@@ -149,7 +148,7 @@ async function e2eProjectGeneratorInternal(host, _options) {
|
|
|
149
148
|
host.rename(jestConfigPath, (0, devkit_1.joinPathFragments)(options.e2eProjectRoot, 'jest.config.cts'));
|
|
150
149
|
}
|
|
151
150
|
if (options.isUsingTsSolutionConfig) {
|
|
152
|
-
(0,
|
|
151
|
+
(0, internal_2.addSwcTestConfig)(host, options.e2eProjectRoot, 'es6');
|
|
153
152
|
(0, devkit_1.generateFiles)(host, path.join(__dirname, 'files/ts-solution'), options.e2eProjectRoot, {
|
|
154
153
|
...options,
|
|
155
154
|
relativeProjectReferencePath: (0, posix_1.relative)(options.e2eProjectRoot, appProject.root),
|
|
@@ -202,7 +201,7 @@ async function e2eProjectGeneratorInternal(host, _options) {
|
|
|
202
201
|
// If we are using the new TS solution
|
|
203
202
|
// We need to update the workspace file (package.json or pnpm-workspaces.yaml) to include the new project
|
|
204
203
|
if (options.isUsingTsSolutionConfig) {
|
|
205
|
-
await (0,
|
|
204
|
+
await (0, internal_2.addProjectToTsSolutionWorkspace)(host, options.e2eProjectRoot);
|
|
206
205
|
}
|
|
207
206
|
if (!options.skipFormat) {
|
|
208
207
|
await (0, devkit_1.formatFiles)(host);
|
|
@@ -226,7 +225,7 @@ async function normalizeOptions(tree, options) {
|
|
|
226
225
|
const nxJson = (0, devkit_1.readNxJson)(tree);
|
|
227
226
|
const addPlugin = process.env.NX_ADD_PLUGINS !== 'false' &&
|
|
228
227
|
nxJson.useInferencePlugins !== false;
|
|
229
|
-
const isUsingTsSolutionConfig = (0,
|
|
228
|
+
const isUsingTsSolutionConfig = (0, internal_2.isUsingTsSolutionSetup)(tree);
|
|
230
229
|
return {
|
|
231
230
|
addPlugin,
|
|
232
231
|
...options,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"library.d.ts","sourceRoot":"","sources":["../../../../../../packages/node/src/generators/library/library.ts"],"names":[],"mappings":"AAKA,OAAO,EAIL,iBAAiB,EAUjB,IAAI,EAIL,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"library.d.ts","sourceRoot":"","sources":["../../../../../../packages/node/src/generators/library/library.ts"],"names":[],"mappings":"AAKA,OAAO,EAIL,iBAAiB,EAUjB,IAAI,EAIL,MAAM,YAAY,CAAC;AAapB,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,MAAM,WAAW,gBAAiB,SAAQ,MAAM;IAC9C,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,QAAQ,EAAE,KAAK,GAAG,KAAK,CAAC;IACxB,uBAAuB,EAAE,OAAO,CAAC;CAClC;AAED,wBAAsB,gBAAgB,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,8BAMhE;AAED,wBAAsB,wBAAwB,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,8BA2ExE;AAED,eAAe,gBAAgB,CAAC"}
|
|
@@ -5,13 +5,10 @@ exports.libraryGeneratorInternal = libraryGeneratorInternal;
|
|
|
5
5
|
const internal_1 = require("@nx/devkit/internal");
|
|
6
6
|
const devkit_1 = require("@nx/devkit");
|
|
7
7
|
const js_1 = require("@nx/js");
|
|
8
|
-
const
|
|
9
|
-
const add_swc_dependencies_1 = require("@nx/js/src/utils/swc/add-swc-dependencies");
|
|
8
|
+
const internal_2 = require("@nx/js/internal");
|
|
10
9
|
const path_1 = require("path");
|
|
11
10
|
const versions_1 = require("../../utils/versions");
|
|
12
11
|
const init_1 = require("../init/init");
|
|
13
|
-
const ts_solution_setup_1 = require("@nx/js/src/utils/typescript/ts-solution-setup");
|
|
14
|
-
const sort_fields_1 = require("@nx/js/src/utils/package-json/sort-fields");
|
|
15
12
|
async function libraryGenerator(tree, schema) {
|
|
16
13
|
return await libraryGeneratorInternal(tree, {
|
|
17
14
|
addPlugin: false,
|
|
@@ -24,7 +21,7 @@ async function libraryGeneratorInternal(tree, schema) {
|
|
|
24
21
|
// If we are using the new TS solution
|
|
25
22
|
// We need to update the workspace file (package.json or pnpm-workspaces.yaml) to include the new project
|
|
26
23
|
if (options.isUsingTsSolutionConfig) {
|
|
27
|
-
await (0,
|
|
24
|
+
await (0, internal_2.addProjectToTsSolutionWorkspace)(tree, options.projectRoot);
|
|
28
25
|
}
|
|
29
26
|
const tasks = [];
|
|
30
27
|
if (options.publishable === true && !schema.importPath) {
|
|
@@ -66,7 +63,7 @@ async function libraryGeneratorInternal(tree, schema) {
|
|
|
66
63
|
if (options.isUsingTsSolutionConfig) {
|
|
67
64
|
tasks.push(() => (0, devkit_1.installPackagesTask)(tree, true));
|
|
68
65
|
}
|
|
69
|
-
(0,
|
|
66
|
+
(0, internal_2.sortPackageJsonFields)(tree, options.projectRoot);
|
|
70
67
|
if (!schema.skipFormat) {
|
|
71
68
|
await (0, devkit_1.formatFiles)(tree);
|
|
72
69
|
}
|
|
@@ -94,8 +91,8 @@ async function normalizeOptions(tree, options) {
|
|
|
94
91
|
// this helper is called before the jsLibraryGenerator is called, so, if the
|
|
95
92
|
// TS solution setup is not configured, we additionally check if the TS
|
|
96
93
|
// solution setup will be configured by the jsLibraryGenerator
|
|
97
|
-
const isUsingTsSolutionConfig = (0,
|
|
98
|
-
(0,
|
|
94
|
+
const isUsingTsSolutionConfig = (0, internal_2.isUsingTsSolutionSetup)(tree) ||
|
|
95
|
+
(0, internal_2.shouldConfigureTsSolutionSetup)(tree, options.addPlugin);
|
|
99
96
|
return {
|
|
100
97
|
...options,
|
|
101
98
|
fileName,
|
|
@@ -152,8 +149,8 @@ function updateProject(tree, options) {
|
|
|
152
149
|
};
|
|
153
150
|
}
|
|
154
151
|
if (options.compiler === 'swc') {
|
|
155
|
-
(0,
|
|
156
|
-
(0,
|
|
152
|
+
(0, internal_2.addSwcDependencies)(tree);
|
|
153
|
+
(0, internal_2.addSwcConfig)(tree, options.projectRoot);
|
|
157
154
|
}
|
|
158
155
|
if (options.rootDir) {
|
|
159
156
|
project.targets.build.options.srcRootForCompilationRoot = options.rootDir;
|