@nx/angular 19.7.0-canary.20240827-61ecd4b → 19.7.0-canary.20240829-0ef6892

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/angular",
3
- "version": "19.7.0-canary.20240827-61ecd4b",
3
+ "version": "19.7.0-canary.20240829-0ef6892",
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.7.0-canary.20240827-61ecd4b",
83
- "@nx/js": "19.7.0-canary.20240827-61ecd4b",
84
- "@nx/eslint": "19.7.0-canary.20240827-61ecd4b",
85
- "@nx/webpack": "19.7.0-canary.20240827-61ecd4b",
86
- "@nx/web": "19.7.0-canary.20240827-61ecd4b",
87
- "@nx/workspace": "19.7.0-canary.20240827-61ecd4b",
82
+ "@nx/devkit": "19.7.0-canary.20240829-0ef6892",
83
+ "@nx/js": "19.7.0-canary.20240829-0ef6892",
84
+ "@nx/eslint": "19.7.0-canary.20240829-0ef6892",
85
+ "@nx/webpack": "19.7.0-canary.20240829-0ef6892",
86
+ "@nx/web": "19.7.0-canary.20240829-0ef6892",
87
+ "@nx/workspace": "19.7.0-canary.20240829-0ef6892",
88
88
  "piscina": "^4.4.0",
89
- "@nrwl/angular": "19.7.0-canary.20240827-61ecd4b"
89
+ "@nrwl/angular": "19.7.0-canary.20240829-0ef6892"
90
90
  },
91
91
  "peerDependencies": {
92
92
  "@angular-devkit/build-angular": ">= 16.0.0 < 19.0.0",
@@ -1,3 +1,3 @@
1
- import type { Tree } from '@nx/devkit';
1
+ import { Tree } from '@nx/devkit';
2
2
  import type { NormalizedSchema } from './normalized-schema';
3
3
  export declare function addE2e(tree: Tree, options: NormalizedSchema): Promise<void>;
@@ -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: `${options.name}:${options.e2eWebServerTarget}:development`,
32
- baseUrl: options.e2eWebServerAddress,
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: `${(0, devkit_1.getPackageManagerCommand)().exec} nx ${options.e2eWebServerTarget} ${options.name}`,
58
- webServerAddress: options.e2eWebServerAddress,
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: options.e2ePort,
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
  }