@nx/angular 19.6.2 → 19.6.4
Sign up to get free protection for your applications and to get access to all the features.
- package/package.json +8 -8
- package/src/generators/application/lib/add-e2e.d.ts +1 -1
- package/src/generators/application/lib/add-e2e.js +35 -8
- package/src/generators/application/lib/normalize-options.js +0 -13
- package/src/generators/application/lib/normalized-schema.d.ts +0 -3
- package/src/generators/setup-mf/lib/change-build-target.js +2 -0
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@nx/angular",
|
3
|
-
"version": "19.6.
|
3
|
+
"version": "19.6.4",
|
4
4
|
"private": false,
|
5
5
|
"description": "The Nx Plugin for Angular contains executors, generators, and utilities for managing Angular applications and libraries within an Nx workspace. It provides: \n\n- Integration with libraries such as Storybook, Jest, ESLint, Tailwind CSS, Playwright and Cypress. \n\n- Generators to help scaffold code quickly (like: Micro Frontends, Libraries, both internal to your codebase and publishable to npm) \n\n- Single Component Application Modules (SCAMs) \n\n- NgRx helpers. \n\n- Utilities for automatic workspace refactoring.",
|
6
6
|
"repository": {
|
@@ -79,14 +79,14 @@
|
|
79
79
|
"webpack-merge": "^5.8.0",
|
80
80
|
"webpack": "^5.88.0",
|
81
81
|
"@module-federation/enhanced": "~0.2.3",
|
82
|
-
"@nx/devkit": "19.6.
|
83
|
-
"@nx/js": "19.6.
|
84
|
-
"@nx/eslint": "19.6.
|
85
|
-
"@nx/webpack": "19.6.
|
86
|
-
"@nx/web": "19.6.
|
87
|
-
"@nx/workspace": "19.6.
|
82
|
+
"@nx/devkit": "19.6.4",
|
83
|
+
"@nx/js": "19.6.4",
|
84
|
+
"@nx/eslint": "19.6.4",
|
85
|
+
"@nx/webpack": "19.6.4",
|
86
|
+
"@nx/web": "19.6.4",
|
87
|
+
"@nx/workspace": "19.6.4",
|
88
88
|
"piscina": "^4.4.0",
|
89
|
-
"@nrwl/angular": "19.6.
|
89
|
+
"@nrwl/angular": "19.6.4"
|
90
90
|
},
|
91
91
|
"peerDependencies": {
|
92
92
|
"@angular-devkit/build-angular": ">= 16.0.0 < 19.0.0",
|
@@ -10,10 +10,11 @@ async function addE2e(tree, options) {
|
|
10
10
|
const nxJson = (0, devkit_1.readNxJson)(tree);
|
11
11
|
const addPlugin = process.env.NX_ADD_PLUGINS !== 'false' &&
|
12
12
|
nxJson.useInferencePlugins !== false;
|
13
|
+
const e2eWebServerInfo = getAngularE2EWebServerInfo(tree, options.name, options.port);
|
14
|
+
// TODO: This can call `@nx/web:static-config` generator when ready
|
15
|
+
addFileServerTarget(tree, options, 'serve-static', e2eWebServerInfo.e2ePort);
|
13
16
|
if (options.e2eTestRunner === 'cypress') {
|
14
17
|
const { configurationGenerator } = (0, devkit_1.ensurePackage)('@nx/cypress', versions_1.nxVersion);
|
15
|
-
// TODO: This can call `@nx/web:static-config` generator when ready
|
16
|
-
addFileServerTarget(tree, options, 'serve-static');
|
17
18
|
(0, devkit_1.addProjectConfiguration)(tree, options.e2eProjectName, {
|
18
19
|
projectType: 'application',
|
19
20
|
root: options.e2eProjectRoot,
|
@@ -28,8 +29,14 @@ async function addE2e(tree, options) {
|
|
28
29
|
linter: options.linter,
|
29
30
|
skipPackageJson: options.skipPackageJson,
|
30
31
|
skipFormat: true,
|
31
|
-
devServerTarget:
|
32
|
-
baseUrl:
|
32
|
+
devServerTarget: e2eWebServerInfo.e2eDevServerTarget,
|
33
|
+
baseUrl: e2eWebServerInfo.e2eWebServerAddress,
|
34
|
+
webServerCommands: {
|
35
|
+
default: e2eWebServerInfo.e2eWebServerCommand,
|
36
|
+
production: e2eWebServerInfo.e2eCiWebServerCommand,
|
37
|
+
},
|
38
|
+
ciWebServerCommand: e2eWebServerInfo.e2eCiWebServerCommand,
|
39
|
+
ciBaseUrl: e2eWebServerInfo.e2eCiBaseUrl,
|
33
40
|
rootProject: options.rootProject,
|
34
41
|
addPlugin,
|
35
42
|
});
|
@@ -54,8 +61,8 @@ async function addE2e(tree, options) {
|
|
54
61
|
js: false,
|
55
62
|
linter: options.linter,
|
56
63
|
setParserOptionsProject: options.setParserOptionsProject,
|
57
|
-
webServerCommand:
|
58
|
-
webServerAddress:
|
64
|
+
webServerCommand: e2eWebServerInfo.e2eWebServerCommand,
|
65
|
+
webServerAddress: e2eWebServerInfo.e2eWebServerAddress,
|
59
66
|
rootProject: options.rootProject,
|
60
67
|
addPlugin,
|
61
68
|
});
|
@@ -64,7 +71,7 @@ async function addE2e(tree, options) {
|
|
64
71
|
}
|
65
72
|
}
|
66
73
|
}
|
67
|
-
function addFileServerTarget(tree, options, targetName) {
|
74
|
+
function addFileServerTarget(tree, options, targetName, e2ePort) {
|
68
75
|
if (!options.skipPackageJson) {
|
69
76
|
(0, devkit_1.addDependenciesToPackageJson)(tree, {}, { '@nx/web': versions_1.nxVersion });
|
70
77
|
}
|
@@ -75,7 +82,7 @@ function addFileServerTarget(tree, options, targetName) {
|
|
75
82
|
executor: '@nx/web:file-server',
|
76
83
|
options: {
|
77
84
|
buildTarget: `${options.name}:build`,
|
78
|
-
port:
|
85
|
+
port: e2ePort,
|
79
86
|
staticFilePath: isUsingApplicationBuilder
|
80
87
|
? (0, devkit_1.joinPathFragments)(options.outputPath, 'browser')
|
81
88
|
: undefined,
|
@@ -84,3 +91,23 @@ function addFileServerTarget(tree, options, targetName) {
|
|
84
91
|
};
|
85
92
|
(0, devkit_1.updateProjectConfiguration)(tree, options.name, projectConfig);
|
86
93
|
}
|
94
|
+
function getAngularE2EWebServerInfo(tree, projectName, portOverride) {
|
95
|
+
const nxJson = (0, devkit_1.readNxJson)(tree);
|
96
|
+
let e2ePort = portOverride ?? 4200;
|
97
|
+
if (nxJson.targetDefaults?.['serve'] &&
|
98
|
+
(nxJson.targetDefaults?.['serve'].options?.port ||
|
99
|
+
nxJson.targetDefaults?.['serve'].options?.env?.PORT)) {
|
100
|
+
e2ePort =
|
101
|
+
nxJson.targetDefaults?.['serve'].options?.port ||
|
102
|
+
nxJson.targetDefaults?.['serve'].options?.env?.PORT;
|
103
|
+
}
|
104
|
+
const pm = (0, devkit_1.getPackageManagerCommand)();
|
105
|
+
return {
|
106
|
+
e2eCiBaseUrl: 'http://localhost:4200',
|
107
|
+
e2eCiWebServerCommand: `${pm.exec} nx run ${projectName}:serve-static`,
|
108
|
+
e2eWebServerCommand: `${pm.exec} nx run ${projectName}:serve`,
|
109
|
+
e2eWebServerAddress: `http://localhost:${e2ePort}`,
|
110
|
+
e2eDevServerTarget: `${projectName}:serve`,
|
111
|
+
e2ePort,
|
112
|
+
};
|
113
|
+
}
|
@@ -18,18 +18,8 @@ async function normalizeOptions(host, options) {
|
|
18
18
|
options.rootProject = appProjectRoot === '.';
|
19
19
|
options.projectNameAndRootFormat = projectNameAndRootFormat;
|
20
20
|
const nxJson = (0, devkit_1.readNxJson)(host);
|
21
|
-
let e2eWebServerTarget = 'serve';
|
22
|
-
let e2ePort = options.port ?? 4200;
|
23
|
-
if (nxJson.targetDefaults?.[e2eWebServerTarget] &&
|
24
|
-
(nxJson.targetDefaults?.[e2eWebServerTarget].options?.port ||
|
25
|
-
nxJson.targetDefaults?.[e2eWebServerTarget].options?.env?.PORT)) {
|
26
|
-
e2ePort =
|
27
|
-
nxJson.targetDefaults?.[e2eWebServerTarget].options?.port ||
|
28
|
-
nxJson.targetDefaults?.[e2eWebServerTarget].options?.env?.PORT;
|
29
|
-
}
|
30
21
|
const e2eProjectName = options.rootProject ? 'e2e' : `${appProjectName}-e2e`;
|
31
22
|
const e2eProjectRoot = options.rootProject ? 'e2e' : `${appProjectRoot}-e2e`;
|
32
|
-
const e2eWebServerAddress = `http://localhost:${e2ePort}`;
|
33
23
|
const parsedTags = options.tags
|
34
24
|
? options.tags.split(',').map((s) => s.trim())
|
35
25
|
: [];
|
@@ -58,9 +48,6 @@ async function normalizeOptions(host, options) {
|
|
58
48
|
appProjectSourceRoot: `${appProjectRoot}/src`,
|
59
49
|
e2eProjectRoot,
|
60
50
|
e2eProjectName,
|
61
|
-
e2eWebServerAddress,
|
62
|
-
e2eWebServerTarget,
|
63
|
-
e2ePort,
|
64
51
|
parsedTags,
|
65
52
|
bundler,
|
66
53
|
outputPath: (0, devkit_1.joinPathFragments)('dist', !options.rootProject ? appProjectRoot : appProjectName),
|
@@ -10,9 +10,6 @@ export interface NormalizedSchema extends Schema {
|
|
10
10
|
appProjectSourceRoot: string;
|
11
11
|
e2eProjectName: string;
|
12
12
|
e2eProjectRoot: string;
|
13
|
-
e2eWebServerAddress: string;
|
14
|
-
e2eWebServerTarget: string;
|
15
|
-
e2ePort: number;
|
16
13
|
parsedTags: string[];
|
17
14
|
outputPath: string;
|
18
15
|
}
|
@@ -2,6 +2,7 @@
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.changeBuildTarget = changeBuildTarget;
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
5
|
+
const target_defaults_utils_1 = require("@nx/devkit/src/generators/target-defaults-utils");
|
5
6
|
function changeBuildTarget(host, options) {
|
6
7
|
const appConfig = (0, devkit_1.readProjectConfiguration)(host, options.appName);
|
7
8
|
const configExtName = options.typescriptConfiguration ? 'ts' : 'js';
|
@@ -19,4 +20,5 @@ function changeBuildTarget(host, options) {
|
|
19
20
|
},
|
20
21
|
};
|
21
22
|
(0, devkit_1.updateProjectConfiguration)(host, options.appName, appConfig);
|
23
|
+
(0, target_defaults_utils_1.addBuildTargetDefaults)(host, '@nx/angular:webpack-browser');
|
22
24
|
}
|