@nx/node 23.0.0-beta.2 → 23.0.0-beta.21
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.d.ts.map +1 -1
- package/src/generators/application/application.js +8 -9
- package/src/generators/application/lib/add-dependencies.js +15 -15
- package/src/generators/application/lib/create-project.d.ts.map +1 -1
- package/src/generators/application/lib/create-project.js +6 -6
- package/src/generators/application/lib/create-targets.js +3 -3
- package/src/generators/application/lib/normalize-options.js +5 -5
- package/src/generators/e2e-project/e2e-project.d.ts.map +1 -1
- package/src/generators/e2e-project/e2e-project.js +16 -20
- package/src/generators/library/library.d.ts.map +1 -1
- package/src/generators/library/library.js +11 -15
- package/src/utils/versions.d.ts +1 -1
- package/src/utils/versions.js +1 -1
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.21",
|
|
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.21",
|
|
37
|
+
"@nx/jest": "23.0.0-beta.21",
|
|
38
|
+
"@nx/js": "23.0.0-beta.21",
|
|
39
|
+
"@nx/eslint": "23.0.0-beta.21",
|
|
40
|
+
"@nx/docker": "23.0.0-beta.21",
|
|
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.21"
|
|
46
46
|
},
|
|
47
47
|
"publishConfig": {
|
|
48
48
|
"access": "public"
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"application.d.ts","sourceRoot":"","sources":["../../../../../../packages/node/src/generators/application/application.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"application.d.ts","sourceRoot":"","sources":["../../../../../../packages/node/src/generators/application/application.ts"],"names":[],"mappings":"AACA,OAAO,EAGL,iBAAiB,EAIjB,IAAI,EAIL,MAAM,YAAY,CAAC;AAapB,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAwClC,wBAAsB,oBAAoB,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,8BAMpE;AAED,wBAAsB,4BAA4B,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,8BAwL5E;AAED,eAAe,oBAAoB,CAAC"}
|
|
@@ -35,12 +35,11 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
36
|
exports.applicationGenerator = applicationGenerator;
|
|
37
37
|
exports.applicationGeneratorInternal = applicationGeneratorInternal;
|
|
38
|
+
const internal_1 = require("@nx/devkit/internal");
|
|
38
39
|
const devkit_1 = require("@nx/devkit");
|
|
39
40
|
const jest_1 = require("@nx/jest");
|
|
40
41
|
const js_1 = require("@nx/js");
|
|
41
|
-
const
|
|
42
|
-
const sort_fields_1 = require("@nx/js/src/utils/package-json/sort-fields");
|
|
43
|
-
const log_show_project_command_1 = require("@nx/devkit/src/utils/log-show-project-command");
|
|
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',
|
|
@@ -111,7 +110,7 @@ async function applicationGeneratorInternal(tree, schema) {
|
|
|
111
110
|
return (0, devkit_1.runTasksInSerial)(...[
|
|
112
111
|
...tasks,
|
|
113
112
|
() => {
|
|
114
|
-
(0,
|
|
113
|
+
(0, internal_1.logShowProjectCommand)(options.name);
|
|
115
114
|
},
|
|
116
115
|
]);
|
|
117
116
|
}
|
|
@@ -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,19 +205,19 @@ 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
|
}
|
|
220
219
|
tasks.push(() => {
|
|
221
|
-
(0,
|
|
220
|
+
(0, internal_1.logShowProjectCommand)(options.name);
|
|
222
221
|
});
|
|
223
222
|
return (0, devkit_1.runTasksInSerial)(...tasks);
|
|
224
223
|
}
|
|
@@ -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
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-project.d.ts","sourceRoot":"","sources":["../../../../../../../packages/node/src/generators/application/lib/create-project.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"create-project.d.ts","sourceRoot":"","sources":["../../../../../../../packages/node/src/generators/application/lib/create-project.ts"],"names":[],"mappings":"AACA,OAAO,EAIL,IAAI,EAEL,MAAM,YAAY,CAAC;AAIpB,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AASvD,wBAAgB,UAAU,CACxB,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,gBAAgB,EACzB,qBAAqB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,QA8D9C"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.addProject = addProject;
|
|
4
|
+
const internal_1 = require("@nx/devkit/internal");
|
|
4
5
|
const devkit_1 = require("@nx/devkit");
|
|
5
|
-
const
|
|
6
|
-
const ts_solution_setup_1 = require("@nx/js/src/utils/typescript/ts-solution-setup");
|
|
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) {
|
|
@@ -15,15 +15,15 @@ function addProject(tree, options, frameworkDependencies) {
|
|
|
15
15
|
tags: options.parsedTags,
|
|
16
16
|
};
|
|
17
17
|
if (options.bundler === 'esbuild') {
|
|
18
|
-
(0,
|
|
19
|
-
|
|
18
|
+
(0, internal_1.addBuildTargetDefaults)(tree, '@nx/esbuild:esbuild', 'build', [
|
|
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
|
-
(0,
|
|
26
|
-
|
|
25
|
+
(0, internal_1.addBuildTargetDefaults)(tree, `@nx/webpack:webpack`, 'build', [
|
|
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}'],
|
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.normalizeOptions = normalizeOptions;
|
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
|
5
|
-
const
|
|
6
|
-
const
|
|
5
|
+
const internal_1 = require("@nx/devkit/internal");
|
|
6
|
+
const internal_2 = require("@nx/js/internal");
|
|
7
7
|
async function normalizeOptions(host, options) {
|
|
8
|
-
await (0,
|
|
9
|
-
const { projectName, projectRoot: appProjectRoot, importPath, } = await (0,
|
|
8
|
+
await (0, internal_1.ensureRootProjectName)(options, 'application');
|
|
9
|
+
const { projectName, projectRoot: appProjectRoot, importPath, } = await (0, internal_1.determineProjectNameAndRootOptions)(host, {
|
|
10
10
|
name: options.name,
|
|
11
11
|
projectType: 'application',
|
|
12
12
|
directory: options.directory,
|
|
@@ -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;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"e2e-project.d.ts","sourceRoot":"","sources":["../../../../../../packages/node/src/generators/e2e-project/e2e-project.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"e2e-project.d.ts","sourceRoot":"","sources":["../../../../../../packages/node/src/generators/e2e-project/e2e-project.ts"],"names":[],"mappings":"AAIA,OAAO,EAKL,iBAAiB,EAOjB,IAAI,EAGL,MAAM,YAAY,CAAC;AAWpB,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAalC,wBAAsB,mBAAmB,CAAC,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,8BAMpE;AAED,wBAAsB,2BAA2B,CAC/C,IAAI,EAAE,IAAI,EACV,QAAQ,EAAE,MAAM,8BAyPjB;AAgDD,eAAe,mBAAmB,CAAC"}
|
|
@@ -3,19 +3,15 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.e2eProjectGenerator = e2eProjectGenerator;
|
|
4
4
|
exports.e2eProjectGeneratorInternal = e2eProjectGeneratorInternal;
|
|
5
5
|
const tslib_1 = require("tslib");
|
|
6
|
+
const internal_1 = require("@nx/devkit/internal");
|
|
6
7
|
const devkit_1 = require("@nx/devkit");
|
|
7
|
-
const project_name_and_root_utils_1 = require("@nx/devkit/src/generators/project-name-and-root-utils");
|
|
8
8
|
const eslint_1 = require("@nx/eslint");
|
|
9
|
-
const
|
|
9
|
+
const internal_2 = require("@nx/eslint/internal");
|
|
10
10
|
const path = tslib_1.__importStar(require("path"));
|
|
11
11
|
const versions_1 = require("../../utils/versions");
|
|
12
|
-
const
|
|
13
|
-
const
|
|
14
|
-
const config_file_1 = require("@nx/jest/src/utils/config/config-file");
|
|
15
|
-
const versions_2 = require("@nx/jest/src/utils/versions");
|
|
16
|
-
const ts_solution_setup_1 = require("@nx/js/src/utils/typescript/ts-solution-setup");
|
|
12
|
+
const internal_3 = require("@nx/jest/internal");
|
|
13
|
+
const internal_4 = require("@nx/js/internal");
|
|
17
14
|
const posix_1 = require("node:path/posix");
|
|
18
|
-
const add_swc_config_1 = require("@nx/js/src/utils/swc/add-swc-config");
|
|
19
15
|
async function e2eProjectGenerator(host, options) {
|
|
20
16
|
return await e2eProjectGeneratorInternal(host, {
|
|
21
17
|
addPlugin: false,
|
|
@@ -28,7 +24,7 @@ async function e2eProjectGeneratorInternal(host, _options) {
|
|
|
28
24
|
const options = await normalizeOptions(host, _options);
|
|
29
25
|
const appProject = (0, devkit_1.readProjectConfiguration)(host, options.project);
|
|
30
26
|
// Detect Jest 30+ to use .cts config files (CommonJS TypeScript)
|
|
31
|
-
const jestMajorVersion = (0,
|
|
27
|
+
const jestMajorVersion = (0, internal_3.getInstalledJestMajorVersion)(host);
|
|
32
28
|
const useCommonJsConfig = jestMajorVersion === null || jestMajorVersion >= 30;
|
|
33
29
|
const jestConfigExt = useCommonJsConfig ? 'cts' : 'ts';
|
|
34
30
|
// TODO(@ndcunningham): This is broken.. the outputs are wrong.. and this isn't using the jest generator
|
|
@@ -102,7 +98,7 @@ async function e2eProjectGeneratorInternal(host, _options) {
|
|
|
102
98
|
};
|
|
103
99
|
});
|
|
104
100
|
}
|
|
105
|
-
const jestPreset = (0,
|
|
101
|
+
const jestPreset = (0, internal_3.findRootJestPreset)(host) ?? 'jest.preset.js';
|
|
106
102
|
const tsConfigFile = options.isUsingTsSolutionConfig
|
|
107
103
|
? 'tsconfig.json'
|
|
108
104
|
: 'tsconfig.spec.json';
|
|
@@ -150,7 +146,7 @@ async function e2eProjectGeneratorInternal(host, _options) {
|
|
|
150
146
|
host.rename(jestConfigPath, (0, devkit_1.joinPathFragments)(options.e2eProjectRoot, 'jest.config.cts'));
|
|
151
147
|
}
|
|
152
148
|
if (options.isUsingTsSolutionConfig) {
|
|
153
|
-
(0,
|
|
149
|
+
(0, internal_4.addSwcTestConfig)(host, options.e2eProjectRoot, 'es6');
|
|
154
150
|
(0, devkit_1.generateFiles)(host, path.join(__dirname, 'files/ts-solution'), options.e2eProjectRoot, {
|
|
155
151
|
...options,
|
|
156
152
|
relativeProjectReferencePath: (0, posix_1.relative)(options.e2eProjectRoot, appProject.root),
|
|
@@ -182,11 +178,11 @@ async function e2eProjectGeneratorInternal(host, _options) {
|
|
|
182
178
|
addPlugin: options.addPlugin,
|
|
183
179
|
});
|
|
184
180
|
tasks.push(linterTask);
|
|
185
|
-
if (options.rootProject && (0,
|
|
186
|
-
(0,
|
|
187
|
-
(0,
|
|
188
|
-
|
|
189
|
-
|
|
181
|
+
if (options.rootProject && (0, internal_2.isEslintConfigSupported)(host)) {
|
|
182
|
+
(0, internal_2.addPluginsToLintConfig)(host, options.e2eProjectRoot, '@nx');
|
|
183
|
+
(0, internal_2.replaceOverridesInLintConfig)(host, options.e2eProjectRoot, [
|
|
184
|
+
internal_2.typeScriptOverride,
|
|
185
|
+
internal_2.javaScriptOverride,
|
|
190
186
|
]);
|
|
191
187
|
}
|
|
192
188
|
}
|
|
@@ -203,13 +199,13 @@ async function e2eProjectGeneratorInternal(host, _options) {
|
|
|
203
199
|
// If we are using the new TS solution
|
|
204
200
|
// We need to update the workspace file (package.json or pnpm-workspaces.yaml) to include the new project
|
|
205
201
|
if (options.isUsingTsSolutionConfig) {
|
|
206
|
-
await (0,
|
|
202
|
+
await (0, internal_4.addProjectToTsSolutionWorkspace)(host, options.e2eProjectRoot);
|
|
207
203
|
}
|
|
208
204
|
if (!options.skipFormat) {
|
|
209
205
|
await (0, devkit_1.formatFiles)(host);
|
|
210
206
|
}
|
|
211
207
|
tasks.push(() => {
|
|
212
|
-
(0,
|
|
208
|
+
(0, internal_1.logShowProjectCommand)(options.e2eProjectName);
|
|
213
209
|
});
|
|
214
210
|
return (0, devkit_1.runTasksInSerial)(...tasks);
|
|
215
211
|
}
|
|
@@ -219,7 +215,7 @@ async function normalizeOptions(tree, options) {
|
|
|
219
215
|
const projectConfig = (0, devkit_1.readProjectConfiguration)(tree, options.project);
|
|
220
216
|
directory = `${projectConfig.root}-e2e`;
|
|
221
217
|
}
|
|
222
|
-
const { projectName: e2eProjectName, projectRoot: e2eProjectRoot, importPath, } = await (0,
|
|
218
|
+
const { projectName: e2eProjectName, projectRoot: e2eProjectRoot, importPath, } = await (0, internal_1.determineProjectNameAndRootOptions)(tree, {
|
|
223
219
|
name: options.name,
|
|
224
220
|
projectType: 'application',
|
|
225
221
|
directory,
|
|
@@ -227,7 +223,7 @@ async function normalizeOptions(tree, options) {
|
|
|
227
223
|
const nxJson = (0, devkit_1.readNxJson)(tree);
|
|
228
224
|
const addPlugin = process.env.NX_ADD_PLUGINS !== 'false' &&
|
|
229
225
|
nxJson.useInferencePlugins !== false;
|
|
230
|
-
const isUsingTsSolutionConfig = (0,
|
|
226
|
+
const isUsingTsSolutionConfig = (0, internal_4.isUsingTsSolutionSetup)(tree);
|
|
231
227
|
return {
|
|
232
228
|
addPlugin,
|
|
233
229
|
...options,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"library.d.ts","sourceRoot":"","sources":["../../../../../../packages/node/src/generators/library/library.ts"],"names":[],"mappings":"
|
|
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"}
|
|
@@ -2,17 +2,13 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.libraryGenerator = libraryGenerator;
|
|
4
4
|
exports.libraryGeneratorInternal = libraryGeneratorInternal;
|
|
5
|
+
const internal_1 = require("@nx/devkit/internal");
|
|
5
6
|
const devkit_1 = require("@nx/devkit");
|
|
6
|
-
const project_name_and_root_utils_1 = require("@nx/devkit/src/generators/project-name-and-root-utils");
|
|
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 target_defaults_utils_1 = require("@nx/devkit/src/generators/target-defaults-utils");
|
|
14
|
-
const ts_solution_setup_1 = require("@nx/js/src/utils/typescript/ts-solution-setup");
|
|
15
|
-
const sort_fields_1 = require("@nx/js/src/utils/package-json/sort-fields");
|
|
16
12
|
async function libraryGenerator(tree, schema) {
|
|
17
13
|
return await libraryGeneratorInternal(tree, {
|
|
18
14
|
addPlugin: false,
|
|
@@ -25,7 +21,7 @@ async function libraryGeneratorInternal(tree, schema) {
|
|
|
25
21
|
// If we are using the new TS solution
|
|
26
22
|
// We need to update the workspace file (package.json or pnpm-workspaces.yaml) to include the new project
|
|
27
23
|
if (options.isUsingTsSolutionConfig) {
|
|
28
|
-
await (0,
|
|
24
|
+
await (0, internal_2.addProjectToTsSolutionWorkspace)(tree, options.projectRoot);
|
|
29
25
|
}
|
|
30
26
|
const tasks = [];
|
|
31
27
|
if (options.publishable === true && !schema.importPath) {
|
|
@@ -67,7 +63,7 @@ async function libraryGeneratorInternal(tree, schema) {
|
|
|
67
63
|
if (options.isUsingTsSolutionConfig) {
|
|
68
64
|
tasks.push(() => (0, devkit_1.installPackagesTask)(tree, true));
|
|
69
65
|
}
|
|
70
|
-
(0,
|
|
66
|
+
(0, internal_2.sortPackageJsonFields)(tree, options.projectRoot);
|
|
71
67
|
if (!schema.skipFormat) {
|
|
72
68
|
await (0, devkit_1.formatFiles)(tree);
|
|
73
69
|
}
|
|
@@ -75,8 +71,8 @@ async function libraryGeneratorInternal(tree, schema) {
|
|
|
75
71
|
}
|
|
76
72
|
exports.default = libraryGenerator;
|
|
77
73
|
async function normalizeOptions(tree, options) {
|
|
78
|
-
await (0,
|
|
79
|
-
const { projectName, names: projectNames, projectRoot, importPath, } = await (0,
|
|
74
|
+
await (0, internal_1.ensureRootProjectName)(options, 'library');
|
|
75
|
+
const { projectName, names: projectNames, projectRoot, importPath, } = await (0, internal_1.determineProjectNameAndRootOptions)(tree, {
|
|
80
76
|
name: options.name,
|
|
81
77
|
projectType: 'library',
|
|
82
78
|
directory: options.directory,
|
|
@@ -95,8 +91,8 @@ async function normalizeOptions(tree, options) {
|
|
|
95
91
|
// this helper is called before the jsLibraryGenerator is called, so, if the
|
|
96
92
|
// TS solution setup is not configured, we additionally check if the TS
|
|
97
93
|
// solution setup will be configured by the jsLibraryGenerator
|
|
98
|
-
const isUsingTsSolutionConfig = (0,
|
|
99
|
-
(0,
|
|
94
|
+
const isUsingTsSolutionConfig = (0, internal_2.isUsingTsSolutionSetup)(tree) ||
|
|
95
|
+
(0, internal_2.shouldConfigureTsSolutionSetup)(tree, options.addPlugin);
|
|
100
96
|
return {
|
|
101
97
|
...options,
|
|
102
98
|
fileName,
|
|
@@ -132,7 +128,7 @@ function updateProject(tree, options) {
|
|
|
132
128
|
const project = (0, devkit_1.readProjectConfiguration)(tree, options.projectName);
|
|
133
129
|
const rootProject = options.projectRoot === '.' || options.projectRoot === '';
|
|
134
130
|
project.targets = project.targets || {};
|
|
135
|
-
(0,
|
|
131
|
+
(0, internal_1.addBuildTargetDefaults)(tree, `@nx/js:${options.compiler}`);
|
|
136
132
|
// For TS solution, we want tsc build to be inferred by `@nx/js/typescript` plugin.
|
|
137
133
|
if (!options.isUsingTsSolutionConfig || options.compiler === 'swc') {
|
|
138
134
|
project.targets.build = {
|
|
@@ -153,8 +149,8 @@ function updateProject(tree, options) {
|
|
|
153
149
|
};
|
|
154
150
|
}
|
|
155
151
|
if (options.compiler === 'swc') {
|
|
156
|
-
(0,
|
|
157
|
-
(0,
|
|
152
|
+
(0, internal_2.addSwcDependencies)(tree);
|
|
153
|
+
(0, internal_2.addSwcConfig)(tree, options.projectRoot);
|
|
158
154
|
}
|
|
159
155
|
if (options.rootDir) {
|
|
160
156
|
project.targets.build.options.srcRootForCompilationRoot = options.rootDir;
|
package/src/utils/versions.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export declare const nxVersion: any;
|
|
2
2
|
export declare const tslibVersion = "^2.3.0";
|
|
3
|
-
export declare const typesNodeVersion = "
|
|
3
|
+
export declare const typesNodeVersion = "^22.0.0";
|
|
4
4
|
export declare const expressVersion = "^4.21.2";
|
|
5
5
|
export declare const expressTypingsVersion = "^4.17.21";
|
|
6
6
|
export declare const koaVersion = "^3.1.2";
|
package/src/utils/versions.js
CHANGED
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.axiosVersion = exports.fastifyPluginVersion = exports.fastifySensibleVersion = exports.fastifyAutoloadVersion = exports.fastifyVersion = exports.koaTypingsVersion = exports.koaVersion = exports.expressTypingsVersion = exports.expressVersion = exports.typesNodeVersion = exports.tslibVersion = exports.nxVersion = void 0;
|
|
4
4
|
exports.nxVersion = require('../../package.json').version;
|
|
5
5
|
exports.tslibVersion = '^2.3.0';
|
|
6
|
-
exports.typesNodeVersion = '
|
|
6
|
+
exports.typesNodeVersion = '^22.0.0';
|
|
7
7
|
exports.expressVersion = '^4.21.2';
|
|
8
8
|
exports.expressTypingsVersion = '^4.17.21';
|
|
9
9
|
exports.koaVersion = '^3.1.2';
|