@nx/node 20.5.0-beta.3 → 20.5.0-canary.20250128-e0c49d3
Sign up to get free protection for your applications and to get access to all the features.
- package/package.json +5 -5
- package/src/generators/application/application.js +2 -6
- package/src/generators/application/files/common/webpack.config.js__tmpl__ +1 -1
- package/src/generators/e2e-project/e2e-project.js +5 -15
- package/src/generators/e2e-project/files/cli/jest.config.ts__tmpl__ +3 -16
- package/src/generators/e2e-project/files/server/common/jest.config.ts__tmpl__ +3 -16
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@nx/node",
|
3
|
-
"version": "20.5.0-
|
3
|
+
"version": "20.5.0-canary.20250128-e0c49d3",
|
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.5.0-
|
36
|
-
"@nx/jest": "20.5.0-
|
37
|
-
"@nx/js": "20.5.0-
|
38
|
-
"@nx/eslint": "20.5.0-
|
35
|
+
"@nx/devkit": "20.5.0-canary.20250128-e0c49d3",
|
36
|
+
"@nx/jest": "20.5.0-canary.20250128-e0c49d3",
|
37
|
+
"@nx/js": "20.5.0-canary.20250128-e0c49d3",
|
38
|
+
"@nx/eslint": "20.5.0-canary.20250128-e0c49d3"
|
39
39
|
},
|
40
40
|
"publishConfig": {
|
41
41
|
"access": "public"
|
@@ -166,9 +166,7 @@ function addAppFiles(tree, options) {
|
|
166
166
|
rootTsConfigPath: (0, js_1.getRelativePathToRootTsConfig)(tree, options.appProjectRoot),
|
167
167
|
webpackPluginOptions: (0, has_webpack_plugin_1.hasWebpackPlugin)(tree)
|
168
168
|
? {
|
169
|
-
outputPath: options.
|
170
|
-
? 'dist'
|
171
|
-
: (0, devkit_1.joinPathFragments)((0, devkit_1.offsetFromRoot)(options.appProjectRoot), 'dist', options.rootProject ? options.name : options.appProjectRoot),
|
169
|
+
outputPath: options.outputPath,
|
172
170
|
main: './src/main' + (options.js ? '.js' : '.ts'),
|
173
171
|
tsConfig: './tsconfig.app.json',
|
174
172
|
assets: ['./src/assets'],
|
@@ -484,9 +482,7 @@ async function normalizeOptions(host, options) {
|
|
484
482
|
unitTestRunner: options.unitTestRunner ?? 'jest',
|
485
483
|
rootProject: options.rootProject ?? false,
|
486
484
|
port: options.port ?? 3000,
|
487
|
-
outputPath:
|
488
|
-
? (0, devkit_1.joinPathFragments)(appProjectRoot, 'dist')
|
489
|
-
: (0, devkit_1.joinPathFragments)('dist', options.rootProject ? options.name : appProjectRoot),
|
485
|
+
outputPath: (0, devkit_1.joinPathFragments)('dist', options.rootProject ? options.name : appProjectRoot),
|
490
486
|
isUsingTsSolutionConfig,
|
491
487
|
swcJest,
|
492
488
|
};
|
@@ -14,7 +14,6 @@ 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");
|
18
17
|
async function e2eProjectGenerator(host, options) {
|
19
18
|
return await e2eProjectGeneratorInternal(host, {
|
20
19
|
addPlugin: false,
|
@@ -97,19 +96,13 @@ async function e2eProjectGeneratorInternal(host, _options) {
|
|
97
96
|
const tsConfigFile = isUsingTsSolutionConfig
|
98
97
|
? 'tsconfig.json'
|
99
98
|
: '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);
|
104
99
|
if (options.projectType === 'server') {
|
105
100
|
(0, devkit_1.generateFiles)(host, path.join(__dirname, 'files/server/common'), options.e2eProjectRoot, {
|
106
101
|
...options,
|
107
102
|
...(0, devkit_1.names)(options.rootProject ? 'server' : options.project),
|
108
103
|
tsConfigFile,
|
109
|
-
offsetFromRoot:
|
104
|
+
offsetFromRoot: (0, devkit_1.offsetFromRoot)(options.e2eProjectRoot),
|
110
105
|
jestPreset,
|
111
|
-
coverageDirectory,
|
112
|
-
isUsingTsSolutionConfig,
|
113
106
|
tmpl: '',
|
114
107
|
});
|
115
108
|
if (options.isNest) {
|
@@ -117,7 +110,7 @@ async function e2eProjectGeneratorInternal(host, _options) {
|
|
117
110
|
...options,
|
118
111
|
...(0, devkit_1.names)(options.rootProject ? 'server' : options.project),
|
119
112
|
tsConfigFile,
|
120
|
-
offsetFromRoot:
|
113
|
+
offsetFromRoot: (0, devkit_1.offsetFromRoot)(options.e2eProjectRoot),
|
121
114
|
tmpl: '',
|
122
115
|
});
|
123
116
|
}
|
@@ -129,26 +122,23 @@ async function e2eProjectGeneratorInternal(host, _options) {
|
|
129
122
|
...(0, devkit_1.names)(options.rootProject ? 'cli' : options.project),
|
130
123
|
mainFile,
|
131
124
|
tsConfigFile,
|
132
|
-
offsetFromRoot:
|
125
|
+
offsetFromRoot: (0, devkit_1.offsetFromRoot)(options.e2eProjectRoot),
|
133
126
|
jestPreset,
|
134
|
-
coverageDirectory,
|
135
|
-
isUsingTsSolutionConfig,
|
136
127
|
tmpl: '',
|
137
128
|
});
|
138
129
|
}
|
139
130
|
if (isUsingTsSolutionConfig) {
|
140
|
-
(0, add_swc_config_1.addSwcTestConfig)(host, options.e2eProjectRoot, 'es6');
|
141
131
|
(0, devkit_1.generateFiles)(host, path.join(__dirname, 'files/ts-solution'), options.e2eProjectRoot, {
|
142
132
|
...options,
|
143
133
|
relativeProjectReferencePath: (0, posix_1.relative)(options.e2eProjectRoot, appProject.root),
|
144
|
-
offsetFromRoot:
|
134
|
+
offsetFromRoot: (0, devkit_1.offsetFromRoot)(options.e2eProjectRoot),
|
145
135
|
tmpl: '',
|
146
136
|
});
|
147
137
|
}
|
148
138
|
else {
|
149
139
|
(0, devkit_1.generateFiles)(host, path.join(__dirname, 'files/non-ts-solution'), options.e2eProjectRoot, {
|
150
140
|
...options,
|
151
|
-
offsetFromRoot:
|
141
|
+
offsetFromRoot: (0, devkit_1.offsetFromRoot)(options.e2eProjectRoot),
|
152
142
|
tmpl: '',
|
153
143
|
});
|
154
144
|
}
|
@@ -1,26 +1,13 @@
|
|
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
|
-
<%_ } _%>
|
14
1
|
export default {
|
15
2
|
displayName: '<%= e2eProjectName %>',
|
16
3
|
preset: '<%= offsetFromRoot %><%= jestPreset %>',
|
17
4
|
setupFiles: ['<rootDir>/src/test-setup.ts'],
|
18
5
|
testEnvironment: 'node',
|
19
6
|
transform: {
|
20
|
-
'^.+\\.[tj]s$':
|
7
|
+
'^.+\\.[tj]s$': ['ts-jest', {
|
21
8
|
tsconfig: '<rootDir>/<%= tsConfigFile %>',
|
22
|
-
}]
|
9
|
+
}],
|
23
10
|
},
|
24
11
|
moduleFileExtensions: ['ts', 'js', 'html'],
|
25
|
-
coverageDirectory: '<%=
|
12
|
+
coverageDirectory: '<%= offsetFromRoot %>coverage/<%= e2eProjectName %>',
|
26
13
|
};
|
@@ -1,16 +1,3 @@
|
|
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
|
-
<%_ } _%>
|
14
1
|
export default {
|
15
2
|
displayName: '<%= e2eProjectName %>',
|
16
3
|
preset: '<%= offsetFromRoot %><%= jestPreset %>',
|
@@ -19,10 +6,10 @@ export default {
|
|
19
6
|
setupFiles: ['<rootDir>/src/support/test-setup.ts'],
|
20
7
|
testEnvironment: 'node',
|
21
8
|
transform: {
|
22
|
-
'^.+\\.[tj]s$':
|
9
|
+
'^.+\\.[tj]s$': ['ts-jest', {
|
23
10
|
tsconfig: '<rootDir>/<%= tsConfigFile %>',
|
24
|
-
}]
|
11
|
+
}],
|
25
12
|
},
|
26
13
|
moduleFileExtensions: ['ts', 'js', 'html'],
|
27
|
-
coverageDirectory: '<%=
|
14
|
+
coverageDirectory: '<%= offsetFromRoot %>coverage/<%= e2eProjectName %>',
|
28
15
|
};
|