@nx/node 20.4.0-canary.20250123-7524356 → 20.4.0-canary.20250124-45847a6

Sign up to get free protection for your applications and to get access to all the features.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nx/node",
3
- "version": "20.4.0-canary.20250123-7524356",
3
+ "version": "20.4.0-canary.20250124-45847a6",
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.4.0-canary.20250123-7524356",
36
- "@nx/jest": "20.4.0-canary.20250123-7524356",
37
- "@nx/js": "20.4.0-canary.20250123-7524356",
38
- "@nx/eslint": "20.4.0-canary.20250123-7524356"
35
+ "@nx/devkit": "20.4.0-canary.20250124-45847a6",
36
+ "@nx/jest": "20.4.0-canary.20250124-45847a6",
37
+ "@nx/js": "20.4.0-canary.20250124-45847a6",
38
+ "@nx/eslint": "20.4.0-canary.20250124-45847a6"
39
39
  },
40
40
  "publishConfig": {
41
41
  "access": "public"
@@ -467,6 +467,8 @@ async function normalizeOptions(host, options) {
467
467
  const nxJson = (0, devkit_1.readNxJson)(host);
468
468
  const addPlugin = process.env.NX_ADD_PLUGINS !== 'false' &&
469
469
  nxJson.useInferencePlugins !== false;
470
+ const isUsingTsSolutionConfig = (0, ts_solution_setup_1.isUsingTsSolutionSetup)(host);
471
+ const swcJest = options.swcJest ?? isUsingTsSolutionConfig;
470
472
  return {
471
473
  addPlugin,
472
474
  ...options,
@@ -481,7 +483,8 @@ async function normalizeOptions(host, options) {
481
483
  rootProject: options.rootProject ?? false,
482
484
  port: options.port ?? 3000,
483
485
  outputPath: (0, devkit_1.joinPathFragments)('dist', options.rootProject ? options.name : appProjectRoot),
484
- isUsingTsSolutionConfig: (0, ts_solution_setup_1.isUsingTsSolutionSetup)(host),
486
+ isUsingTsSolutionConfig,
487
+ swcJest,
485
488
  };
486
489
  }
487
490
  exports.default = applicationGenerator;
@@ -69,8 +69,7 @@
69
69
  },
70
70
  "swcJest": {
71
71
  "type": "boolean",
72
- "description": "Use `@swc/jest` instead `ts-jest` for faster test compilation.",
73
- "default": false
72
+ "description": "Use `@swc/jest` instead `ts-jest` for faster test compilation."
74
73
  },
75
74
  "babelJest": {
76
75
  "type": "boolean",
@@ -10,7 +10,5 @@
10
10
  "jest.config.ts",
11
11
  "src/**/*.ts"
12
12
  ],
13
- "references": [
14
- { "path": "<%= relativeProjectReferencePath %>" }
15
- ]
13
+ "references": []
16
14
  }
@@ -22,6 +22,11 @@ async function libraryGenerator(tree, schema) {
22
22
  }
23
23
  async function libraryGeneratorInternal(tree, schema) {
24
24
  const options = await normalizeOptions(tree, schema);
25
+ // If we are using the new TS solution
26
+ // We need to update the workspace file (package.json or pnpm-workspaces.yaml) to include the new project
27
+ if (options.isUsingTsSolutionConfig) {
28
+ (0, ts_solution_setup_1.addProjectToTsSolutionWorkspace)(tree, options.projectRoot);
29
+ }
25
30
  const tasks = [];
26
31
  if (options.publishable === true && !schema.importPath) {
27
32
  throw new Error(`For publishable libs you have to provide a proper "--importPath" which needs to be a valid npm package name (e.g. my-awesome-lib or @myorg/my-lib)`);
@@ -62,11 +67,6 @@ async function libraryGeneratorInternal(tree, schema) {
62
67
  if (options.isUsingTsSolutionConfig) {
63
68
  tasks.push(() => (0, devkit_1.installPackagesTask)(tree, true));
64
69
  }
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
70
  (0, sort_fields_1.sortPackageJsonFields)(tree, options.projectRoot);
71
71
  if (!schema.skipFormat) {
72
72
  await (0, devkit_1.formatFiles)(tree);
@@ -92,14 +92,17 @@ async function normalizeOptions(tree, options) {
92
92
  const parsedTags = options.tags
93
93
  ? options.tags.split(',').map((s) => s.trim())
94
94
  : [];
95
+ const isUsingTsSolutionConfig = (0, ts_solution_setup_1.isUsingTsSolutionSetup)(tree);
95
96
  return {
96
97
  ...options,
97
98
  fileName,
98
- projectName,
99
+ projectName: isUsingTsSolutionConfig
100
+ ? (0, get_import_path_1.getImportPath)(tree, projectName)
101
+ : projectName,
99
102
  projectRoot,
100
103
  parsedTags,
101
104
  importPath,
102
- isUsingTsSolutionConfig: (0, ts_solution_setup_1.isUsingTsSolutionSetup)(tree),
105
+ isUsingTsSolutionConfig,
103
106
  };
104
107
  }
105
108
  function createFiles(tree, options) {