@nx/node 0.0.0-pr-29750-cc9549c → 0.0.0-pr-29860-43e1fcb

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/migrations.json CHANGED
@@ -18,6 +18,35 @@
18
18
  "alwaysAddToPackageJson": false
19
19
  }
20
20
  }
21
+ },
22
+ "20.4.0": {
23
+ "version": "20.4.0-beta.3",
24
+ "packages": {
25
+ "fastify": {
26
+ "version": "~5.2.1",
27
+ "alwaysAddToPackageJson": false
28
+ },
29
+ "fastify-plugin": {
30
+ "version": "~5.0.1",
31
+ "alwaysAddToPackageJson": false
32
+ },
33
+ "@fastify/autoload": {
34
+ "version": "~6.0.3",
35
+ "alwaysAddToPackageJson": false
36
+ },
37
+ "@fastify/sensible": {
38
+ "version": "~6.0.2",
39
+ "alwaysAddToPackageJson": false
40
+ },
41
+ "express": {
42
+ "version": "^4.21.2",
43
+ "alwaysAddToPackageJson": false
44
+ },
45
+ "@types/express": {
46
+ "version": "^4.17.21",
47
+ "alwaysAddToPackageJson": false
48
+ }
49
+ }
21
50
  }
22
51
  }
23
52
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nx/node",
3
- "version": "0.0.0-pr-29750-cc9549c",
3
+ "version": "0.0.0-pr-29860-43e1fcb",
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": "0.0.0-pr-29750-cc9549c",
36
- "@nx/jest": "0.0.0-pr-29750-cc9549c",
37
- "@nx/js": "0.0.0-pr-29750-cc9549c",
38
- "@nx/eslint": "0.0.0-pr-29750-cc9549c"
35
+ "@nx/devkit": "0.0.0-pr-29860-43e1fcb",
36
+ "@nx/jest": "0.0.0-pr-29860-43e1fcb",
37
+ "@nx/js": "0.0.0-pr-29860-43e1fcb",
38
+ "@nx/eslint": "0.0.0-pr-29860-43e1fcb"
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",
@@ -14,6 +14,7 @@ const config_file_1 = require("@nx/jest/src/utils/config/config-file");
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
16
  const posix_1 = require("node:path/posix");
17
+ const add_swc_config_1 = require("@nx/js/src/utils/swc/add-swc-config");
17
18
  async function e2eProjectGenerator(host, options) {
18
19
  return await e2eProjectGeneratorInternal(host, {
19
20
  addPlugin: false,
@@ -96,13 +97,19 @@ async function e2eProjectGeneratorInternal(host, _options) {
96
97
  const tsConfigFile = isUsingTsSolutionConfig
97
98
  ? 'tsconfig.json'
98
99
  : 'tsconfig.spec.json';
100
+ const rootOffset = (0, devkit_1.offsetFromRoot)(options.e2eProjectRoot);
101
+ const coverageDirectory = isUsingTsSolutionConfig
102
+ ? 'test-output/jest/coverage'
103
+ : (0, devkit_1.joinPathFragments)(rootOffset, 'coverage', options.e2eProjectName);
99
104
  if (options.projectType === 'server') {
100
105
  (0, devkit_1.generateFiles)(host, path.join(__dirname, 'files/server/common'), options.e2eProjectRoot, {
101
106
  ...options,
102
107
  ...(0, devkit_1.names)(options.rootProject ? 'server' : options.project),
103
108
  tsConfigFile,
104
- offsetFromRoot: (0, devkit_1.offsetFromRoot)(options.e2eProjectRoot),
109
+ offsetFromRoot: rootOffset,
105
110
  jestPreset,
111
+ coverageDirectory,
112
+ isUsingTsSolutionConfig,
106
113
  tmpl: '',
107
114
  });
108
115
  if (options.isNest) {
@@ -110,7 +117,7 @@ async function e2eProjectGeneratorInternal(host, _options) {
110
117
  ...options,
111
118
  ...(0, devkit_1.names)(options.rootProject ? 'server' : options.project),
112
119
  tsConfigFile,
113
- offsetFromRoot: (0, devkit_1.offsetFromRoot)(options.e2eProjectRoot),
120
+ offsetFromRoot: rootOffset,
114
121
  tmpl: '',
115
122
  });
116
123
  }
@@ -122,23 +129,26 @@ async function e2eProjectGeneratorInternal(host, _options) {
122
129
  ...(0, devkit_1.names)(options.rootProject ? 'cli' : options.project),
123
130
  mainFile,
124
131
  tsConfigFile,
125
- offsetFromRoot: (0, devkit_1.offsetFromRoot)(options.e2eProjectRoot),
132
+ offsetFromRoot: rootOffset,
126
133
  jestPreset,
134
+ coverageDirectory,
135
+ isUsingTsSolutionConfig,
127
136
  tmpl: '',
128
137
  });
129
138
  }
130
139
  if (isUsingTsSolutionConfig) {
140
+ (0, add_swc_config_1.addSwcTestConfig)(host, options.e2eProjectRoot, 'es6');
131
141
  (0, devkit_1.generateFiles)(host, path.join(__dirname, 'files/ts-solution'), options.e2eProjectRoot, {
132
142
  ...options,
133
143
  relativeProjectReferencePath: (0, posix_1.relative)(options.e2eProjectRoot, appProject.root),
134
- offsetFromRoot: (0, devkit_1.offsetFromRoot)(options.e2eProjectRoot),
144
+ offsetFromRoot: rootOffset,
135
145
  tmpl: '',
136
146
  });
137
147
  }
138
148
  else {
139
149
  (0, devkit_1.generateFiles)(host, path.join(__dirname, 'files/non-ts-solution'), options.e2eProjectRoot, {
140
150
  ...options,
141
- offsetFromRoot: (0, devkit_1.offsetFromRoot)(options.e2eProjectRoot),
151
+ offsetFromRoot: rootOffset,
142
152
  tmpl: '',
143
153
  });
144
154
  }
@@ -1,13 +1,26 @@
1
+ <%_ if (isUsingTsSolutionConfig) { _%>
2
+ /* eslint-disable */
3
+ import { readFileSync } from 'fs';
4
+
5
+ // Reading the SWC compilation config for the spec files
6
+ const swcJestConfig = JSON.parse(
7
+ readFileSync(`${__dirname}/.spec.swcrc`, 'utf-8')
8
+ );
9
+
10
+ // Disable .swcrc look-up by SWC core because we're passing in swcJestConfig ourselves
11
+ swcJestConfig.swcrc = false;
12
+
13
+ <%_ } _%>
1
14
  export default {
2
15
  displayName: '<%= e2eProjectName %>',
3
16
  preset: '<%= offsetFromRoot %><%= jestPreset %>',
4
17
  setupFiles: ['<rootDir>/src/test-setup.ts'],
5
18
  testEnvironment: 'node',
6
19
  transform: {
7
- '^.+\\.[tj]s$': ['ts-jest', {
20
+ '^.+\\.[tj]s$': <% if (isUsingTsSolutionConfig) { %>['@swc/jest', swcJestConfig]<% } else { %>['ts-jest', {
8
21
  tsconfig: '<rootDir>/<%= tsConfigFile %>',
9
- }],
22
+ }]<% } %>,
10
23
  },
11
24
  moduleFileExtensions: ['ts', 'js', 'html'],
12
- coverageDirectory: '<%= offsetFromRoot %>coverage/<%= e2eProjectName %>',
25
+ coverageDirectory: '<%= coverageDirectory %>',
13
26
  };
@@ -1,3 +1,16 @@
1
+ <%_ if (isUsingTsSolutionConfig) { _%>
2
+ /* eslint-disable */
3
+ import { readFileSync } from 'fs';
4
+
5
+ // Reading the SWC compilation config for the spec files
6
+ const swcJestConfig = JSON.parse(
7
+ readFileSync(`${__dirname}/.spec.swcrc`, 'utf-8')
8
+ );
9
+
10
+ // Disable .swcrc look-up by SWC core because we're passing in swcJestConfig ourselves
11
+ swcJestConfig.swcrc = false;
12
+
13
+ <%_ } _%>
1
14
  export default {
2
15
  displayName: '<%= e2eProjectName %>',
3
16
  preset: '<%= offsetFromRoot %><%= jestPreset %>',
@@ -6,10 +19,10 @@ export default {
6
19
  setupFiles: ['<rootDir>/src/support/test-setup.ts'],
7
20
  testEnvironment: 'node',
8
21
  transform: {
9
- '^.+\\.[tj]s$': ['ts-jest', {
22
+ '^.+\\.[tj]s$': <% if (isUsingTsSolutionConfig) { %>['@swc/jest', swcJestConfig]<% } else { %>['ts-jest', {
10
23
  tsconfig: '<rootDir>/<%= tsConfigFile %>',
11
- }],
24
+ }]<% } %>,
12
25
  },
13
26
  moduleFileExtensions: ['ts', 'js', 'html'],
14
- coverageDirectory: '<%= offsetFromRoot %>coverage/<%= e2eProjectName %>',
27
+ coverageDirectory: '<%= coverageDirectory %>',
15
28
  };
@@ -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) {
@@ -1,12 +1,12 @@
1
1
  export declare const nxVersion: any;
2
2
  export declare const tslibVersion = "^2.3.0";
3
3
  export declare const typesNodeVersion = "~18.16.9";
4
- export declare const expressVersion = "~4.18.1";
5
- export declare const expressTypingsVersion = "~4.17.13";
4
+ export declare const expressVersion = "^4.21.2";
5
+ export declare const expressTypingsVersion = "^4.17.21";
6
6
  export declare const koaVersion = "~2.14.1";
7
7
  export declare const koaTypingsVersion = "~2.13.5";
8
- export declare const fastifyVersion = "~4.13.0";
9
- export declare const fastifyAutoloadVersion = "~5.7.1";
10
- export declare const fastifySensibleVersion = "~5.2.0";
11
- export declare const fastifyPluginVersion = "~4.5.0";
8
+ export declare const fastifyVersion = "~5.2.1";
9
+ export declare const fastifyAutoloadVersion = "~6.0.3";
10
+ export declare const fastifySensibleVersion = "~6.0.2";
11
+ export declare const fastifyPluginVersion = "~5.0.1";
12
12
  export declare const axiosVersion = "^1.6.0";
@@ -4,12 +4,12 @@ exports.axiosVersion = exports.fastifyPluginVersion = exports.fastifySensibleVer
4
4
  exports.nxVersion = require('../../package.json').version;
5
5
  exports.tslibVersion = '^2.3.0';
6
6
  exports.typesNodeVersion = '~18.16.9';
7
- exports.expressVersion = '~4.18.1';
8
- exports.expressTypingsVersion = '~4.17.13';
7
+ exports.expressVersion = '^4.21.2';
8
+ exports.expressTypingsVersion = '^4.17.21';
9
9
  exports.koaVersion = '~2.14.1';
10
10
  exports.koaTypingsVersion = '~2.13.5';
11
- exports.fastifyVersion = '~4.13.0';
12
- exports.fastifyAutoloadVersion = '~5.7.1';
13
- exports.fastifySensibleVersion = '~5.2.0';
14
- exports.fastifyPluginVersion = '~4.5.0';
11
+ exports.fastifyVersion = '~5.2.1';
12
+ exports.fastifyAutoloadVersion = '~6.0.3';
13
+ exports.fastifySensibleVersion = '~6.0.2';
14
+ exports.fastifyPluginVersion = '~5.0.1';
15
15
  exports.axiosVersion = '^1.6.0';