@nx/node 20.3.1 → 20.3.3
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/LICENSE
CHANGED
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@nx/node",
|
3
|
-
"version": "20.3.
|
3
|
+
"version": "20.3.3",
|
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.3.
|
36
|
-
"@nx/jest": "20.3.
|
37
|
-
"@nx/js": "20.3.
|
38
|
-
"@nx/eslint": "20.3.
|
35
|
+
"@nx/devkit": "20.3.3",
|
36
|
+
"@nx/jest": "20.3.3",
|
37
|
+
"@nx/js": "20.3.3",
|
38
|
+
"@nx/eslint": "20.3.3"
|
39
39
|
},
|
40
40
|
"publishConfig": {
|
41
41
|
"access": "public"
|
@@ -19,6 +19,7 @@ const has_webpack_plugin_1 = require("../../utils/has-webpack-plugin");
|
|
19
19
|
const target_defaults_utils_1 = require("@nx/devkit/src/generators/target-defaults-utils");
|
20
20
|
const log_show_project_command_1 = require("@nx/devkit/src/utils/log-show-project-command");
|
21
21
|
const ts_solution_setup_1 = require("@nx/js/src/utils/typescript/ts-solution-setup");
|
22
|
+
const sort_fields_1 = require("@nx/js/src/utils/package-json/sort-fields");
|
22
23
|
function getWebpackBuildConfig(project, options) {
|
23
24
|
return {
|
24
25
|
executor: `@nx/webpack:webpack`,
|
@@ -427,9 +428,6 @@ async function applicationGeneratorInternal(tree, schema) {
|
|
427
428
|
});
|
428
429
|
tasks.push(dockerTask);
|
429
430
|
}
|
430
|
-
if (!options.skipFormat) {
|
431
|
-
await (0, devkit_1.formatFiles)(tree);
|
432
|
-
}
|
433
431
|
if (options.isUsingTsSolutionConfig) {
|
434
432
|
(0, ts_solution_setup_1.updateTsconfigFiles)(tree, options.appProjectRoot, 'tsconfig.app.json', {
|
435
433
|
module: 'nodenext',
|
@@ -438,6 +436,15 @@ async function applicationGeneratorInternal(tree, schema) {
|
|
438
436
|
? ['eslint.config.js', 'eslint.config.cjs', 'eslint.config.mjs']
|
439
437
|
: undefined);
|
440
438
|
}
|
439
|
+
// If we are using the new TS solution
|
440
|
+
// We need to update the workspace file (package.json or pnpm-workspaces.yaml) to include the new project
|
441
|
+
if (options.isUsingTsSolutionConfig) {
|
442
|
+
(0, ts_solution_setup_1.addProjectToTsSolutionWorkspace)(tree, options.appProjectRoot);
|
443
|
+
}
|
444
|
+
(0, sort_fields_1.sortPackageJsonFields)(tree, options.appProjectRoot);
|
445
|
+
if (!options.skipFormat) {
|
446
|
+
await (0, devkit_1.formatFiles)(tree);
|
447
|
+
}
|
441
448
|
tasks.push(() => {
|
442
449
|
(0, log_show_project_command_1.logShowProjectCommand)(options.name);
|
443
450
|
});
|
@@ -167,9 +167,6 @@ async function e2eProjectGeneratorInternal(host, _options) {
|
|
167
167
|
]);
|
168
168
|
}
|
169
169
|
}
|
170
|
-
if (!options.skipFormat) {
|
171
|
-
await (0, devkit_1.formatFiles)(host);
|
172
|
-
}
|
173
170
|
if (isUsingTsSolutionConfig) {
|
174
171
|
(0, devkit_1.updateJson)(host, 'tsconfig.json', (json) => {
|
175
172
|
json.references ??= [];
|
@@ -180,6 +177,14 @@ async function e2eProjectGeneratorInternal(host, _options) {
|
|
180
177
|
return json;
|
181
178
|
});
|
182
179
|
}
|
180
|
+
// If we are using the new TS solution
|
181
|
+
// We need to update the workspace file (package.json or pnpm-workspaces.yaml) to include the new project
|
182
|
+
if (isUsingTsSolutionConfig) {
|
183
|
+
(0, ts_solution_setup_1.addProjectToTsSolutionWorkspace)(host, options.e2eProjectRoot);
|
184
|
+
}
|
185
|
+
if (!options.skipFormat) {
|
186
|
+
await (0, devkit_1.formatFiles)(host);
|
187
|
+
}
|
183
188
|
tasks.push(() => {
|
184
189
|
(0, log_show_project_command_1.logShowProjectCommand)(options.e2eProjectName);
|
185
190
|
});
|
@@ -13,6 +13,7 @@ const init_1 = require("../init/init");
|
|
13
13
|
const target_defaults_utils_1 = require("@nx/devkit/src/generators/target-defaults-utils");
|
14
14
|
const ts_solution_setup_1 = require("@nx/js/src/utils/typescript/ts-solution-setup");
|
15
15
|
const get_import_path_1 = require("@nx/js/src/utils/get-import-path");
|
16
|
+
const sort_fields_1 = require("@nx/js/src/utils/package-json/sort-fields");
|
16
17
|
async function libraryGenerator(tree, schema) {
|
17
18
|
return await libraryGeneratorInternal(tree, {
|
18
19
|
addPlugin: false,
|
@@ -46,6 +47,7 @@ async function libraryGeneratorInternal(tree, schema) {
|
|
46
47
|
setParserOptionsProject: schema.setParserOptionsProject,
|
47
48
|
useProjectJson: !options.isUsingTsSolutionConfig,
|
48
49
|
}));
|
50
|
+
updatePackageJson(tree, options);
|
49
51
|
tasks.push(await (0, init_1.initGenerator)(tree, {
|
50
52
|
...options,
|
51
53
|
skipFormat: true,
|
@@ -60,6 +62,12 @@ async function libraryGeneratorInternal(tree, schema) {
|
|
60
62
|
if (options.isUsingTsSolutionConfig) {
|
61
63
|
tasks.push(() => (0, devkit_1.installPackagesTask)(tree, true));
|
62
64
|
}
|
65
|
+
// If we are using the new TS solution
|
66
|
+
// We need to update the workspace file (package.json or pnpm-workspaces.yaml) to include the new project
|
67
|
+
if (options.isUsingTsSolutionConfig) {
|
68
|
+
(0, ts_solution_setup_1.addProjectToTsSolutionWorkspace)(tree, options.projectRoot);
|
69
|
+
}
|
70
|
+
(0, sort_fields_1.sortPackageJsonFields)(tree, options.projectRoot);
|
63
71
|
if (!schema.skipFormat) {
|
64
72
|
await (0, devkit_1.formatFiles)(tree);
|
65
73
|
}
|
@@ -150,3 +158,16 @@ function updateProject(tree, options) {
|
|
150
158
|
function ensureDependencies(tree) {
|
151
159
|
return (0, devkit_1.addDependenciesToPackageJson)(tree, { tslib: versions_1.tslibVersion }, { '@types/node': versions_1.typesNodeVersion });
|
152
160
|
}
|
161
|
+
function updatePackageJson(tree, options) {
|
162
|
+
const packageJsonPath = (0, devkit_1.joinPathFragments)(options.projectRoot, 'package.json');
|
163
|
+
if (!tree.exists(packageJsonPath)) {
|
164
|
+
return;
|
165
|
+
}
|
166
|
+
const packageJson = (0, devkit_1.readJson)(tree, packageJsonPath);
|
167
|
+
if (packageJson.type === 'module') {
|
168
|
+
// The @nx/js:lib generator can set the type to 'module' which would
|
169
|
+
// potentially break consumers of the library.
|
170
|
+
delete packageJson.type;
|
171
|
+
}
|
172
|
+
(0, devkit_1.writeJson)(tree, packageJsonPath, packageJson);
|
173
|
+
}
|