@nx/node 20.3.1 → 20.4.0-beta.0

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
@@ -1,6 +1,6 @@
1
1
  (The MIT License)
2
2
 
3
- Copyright (c) 2017-2024 Narwhal Technologies Inc.
3
+ Copyright (c) 2017-2025 Narwhal Technologies Inc.
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining
6
6
  a copy of this software and associated documentation files (the
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nx/node",
3
- "version": "20.3.1",
3
+ "version": "20.4.0-beta.0",
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.1",
36
- "@nx/jest": "20.3.1",
37
- "@nx/js": "20.3.1",
38
- "@nx/eslint": "20.3.1"
35
+ "@nx/devkit": "20.4.0-beta.0",
36
+ "@nx/jest": "20.4.0-beta.0",
37
+ "@nx/js": "20.4.0-beta.0",
38
+ "@nx/eslint": "20.4.0-beta.0"
39
39
  },
40
40
  "publishConfig": {
41
41
  "access": "public"
@@ -427,9 +427,6 @@ async function applicationGeneratorInternal(tree, schema) {
427
427
  });
428
428
  tasks.push(dockerTask);
429
429
  }
430
- if (!options.skipFormat) {
431
- await (0, devkit_1.formatFiles)(tree);
432
- }
433
430
  if (options.isUsingTsSolutionConfig) {
434
431
  (0, ts_solution_setup_1.updateTsconfigFiles)(tree, options.appProjectRoot, 'tsconfig.app.json', {
435
432
  module: 'nodenext',
@@ -438,6 +435,14 @@ async function applicationGeneratorInternal(tree, schema) {
438
435
  ? ['eslint.config.js', 'eslint.config.cjs', 'eslint.config.mjs']
439
436
  : undefined);
440
437
  }
438
+ // If we are using the new TS solution
439
+ // We need to update the workspace file (package.json or pnpm-workspaces.yaml) to include the new project
440
+ if (options.isUsingTsSolutionConfig) {
441
+ (0, ts_solution_setup_1.addProjectToTsSolutionWorkspace)(tree, options.appProjectRoot);
442
+ }
443
+ if (!options.skipFormat) {
444
+ await (0, devkit_1.formatFiles)(tree);
445
+ }
441
446
  tasks.push(() => {
442
447
  (0, log_show_project_command_1.logShowProjectCommand)(options.name);
443
448
  });
@@ -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
  });
@@ -46,6 +46,7 @@ async function libraryGeneratorInternal(tree, schema) {
46
46
  setParserOptionsProject: schema.setParserOptionsProject,
47
47
  useProjectJson: !options.isUsingTsSolutionConfig,
48
48
  }));
49
+ updatePackageJson(tree, options);
49
50
  tasks.push(await (0, init_1.initGenerator)(tree, {
50
51
  ...options,
51
52
  skipFormat: true,
@@ -60,6 +61,11 @@ async function libraryGeneratorInternal(tree, schema) {
60
61
  if (options.isUsingTsSolutionConfig) {
61
62
  tasks.push(() => (0, devkit_1.installPackagesTask)(tree, true));
62
63
  }
64
+ // If we are using the new TS solution
65
+ // We need to update the workspace file (package.json or pnpm-workspaces.yaml) to include the new project
66
+ if (options.isUsingTsSolutionConfig) {
67
+ (0, ts_solution_setup_1.addProjectToTsSolutionWorkspace)(tree, options.projectRoot);
68
+ }
63
69
  if (!schema.skipFormat) {
64
70
  await (0, devkit_1.formatFiles)(tree);
65
71
  }
@@ -150,3 +156,12 @@ function updateProject(tree, options) {
150
156
  function ensureDependencies(tree) {
151
157
  return (0, devkit_1.addDependenciesToPackageJson)(tree, { tslib: versions_1.tslibVersion }, { '@types/node': versions_1.typesNodeVersion });
152
158
  }
159
+ function updatePackageJson(tree, options) {
160
+ const packageJson = (0, devkit_1.readJson)(tree, (0, devkit_1.joinPathFragments)(options.projectRoot, 'package.json'));
161
+ if (packageJson.type === 'module') {
162
+ // The @nx/js:lib generator can set the type to 'module' which would
163
+ // potentially break consumers of the library.
164
+ delete packageJson.type;
165
+ }
166
+ (0, devkit_1.writeJson)(tree, (0, devkit_1.joinPathFragments)(options.projectRoot, 'package.json'), packageJson);
167
+ }