@nx/angular 22.2.3 → 22.2.5

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nx/angular",
3
- "version": "22.2.3",
3
+ "version": "22.2.5",
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": {
@@ -62,14 +62,14 @@
62
62
  "migrations": "./migrations.json"
63
63
  },
64
64
  "dependencies": {
65
- "@nx/devkit": "22.2.3",
66
- "@nx/eslint": "22.2.3",
67
- "@nx/js": "22.2.3",
68
- "@nx/module-federation": "22.2.3",
69
- "@nx/rspack": "22.2.3",
70
- "@nx/web": "22.2.3",
71
- "@nx/webpack": "22.2.3",
72
- "@nx/workspace": "22.2.3",
65
+ "@nx/devkit": "22.2.5",
66
+ "@nx/eslint": "22.2.5",
67
+ "@nx/js": "22.2.5",
68
+ "@nx/module-federation": "22.2.5",
69
+ "@nx/rspack": "22.2.5",
70
+ "@nx/web": "22.2.5",
71
+ "@nx/webpack": "22.2.5",
72
+ "@nx/workspace": "22.2.5",
73
73
  "@phenomnomnominal/tsquery": "~5.0.1",
74
74
  "@typescript-eslint/type-utils": "^8.0.0",
75
75
  "enquirer": "~2.3.6",
@@ -1 +1 @@
1
- {"version":3,"file":"cypress-component-configuration.d.ts","sourceRoot":"","sources":["../../../../../../packages/angular/src/generators/cypress-component-configuration/cypress-component-configuration.ts"],"names":[],"mappings":"AAEA,OAAO,EAGL,iBAAiB,EAIjB,IAAI,EAEL,MAAM,YAAY,CAAC;AAWpB,OAAO,EAAE,4BAA4B,EAAE,MAAM,UAAU,CAAC;AAExD;;;GAGG;AACH,wBAAsB,6BAA6B,CACjD,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,4BAA4B,GACpC,OAAO,CAAC,iBAAiB,CAAC,CAwB5B;AA4HD,eAAe,6BAA6B,CAAC"}
1
+ {"version":3,"file":"cypress-component-configuration.d.ts","sourceRoot":"","sources":["../../../../../../packages/angular/src/generators/cypress-component-configuration/cypress-component-configuration.ts"],"names":[],"mappings":"AAEA,OAAO,EAGL,iBAAiB,EAIjB,IAAI,EAEL,MAAM,YAAY,CAAC;AAWpB,OAAO,EAAE,4BAA4B,EAAE,MAAM,UAAU,CAAC;AAgBxD;;;GAGG;AACH,wBAAsB,6BAA6B,CACjD,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,4BAA4B,GACpC,OAAO,CAAC,iBAAiB,CAAC,CAwB5B;AA0ID,eAAe,6BAA6B,CAAC"}
@@ -9,6 +9,18 @@ const component_info_1 = require("../utils/storybook-ast/component-info");
9
9
  const entry_point_1 = require("../utils/storybook-ast/entry-point");
10
10
  const module_info_1 = require("../utils/storybook-ast/module-info");
11
11
  const update_app_editor_tsconfig_excluded_files_1 = require("../utils/update-app-editor-tsconfig-excluded-files");
12
+ const webpackExecutors = new Set([
13
+ '@nx/angular:webpack-browser',
14
+ '@nrwl/angular:webpack-browser',
15
+ '@angular-devkit/build-angular:browser',
16
+ ]);
17
+ const esbuildExecutors = new Set([
18
+ '@angular/build:application',
19
+ '@angular-devkit/build-angular:application',
20
+ '@nx/angular:application',
21
+ '@angular-devkit/build-angular:browser-esbuild',
22
+ '@nx/angular:browser-esbuild',
23
+ ]);
12
24
  /**
13
25
  * This is for cypress built in component testing, if you want to test with
14
26
  * storybook + cypress then use the componentCypressGenerator instead.
@@ -66,13 +78,25 @@ async function configureCypressCT(tree, options) {
66
78
  found = await findBuildConfig(tree, {
67
79
  project: options.project,
68
80
  buildTarget: options.buildTarget,
69
- validExecutorNames: new Set([
70
- '@nx/angular:webpack-browser',
71
- '@nrwl/angular:webpack-browser',
72
- '@angular-devkit/build-angular:browser',
73
- ]),
81
+ validExecutorNames: webpackExecutors,
74
82
  });
75
- assertValidConfig(found?.config);
83
+ if (!found?.config) {
84
+ // Check if the project uses an esbuild-based executor
85
+ const esbuildTarget = await findBuildConfig(tree, {
86
+ project: options.project,
87
+ validExecutorNames: esbuildExecutors,
88
+ skipGetOptions: true,
89
+ });
90
+ if (esbuildTarget?.target) {
91
+ const projectConfig = (0, devkit_1.readProjectConfiguration)(tree, esbuildTarget.target.split(':')[0]);
92
+ const targetName = esbuildTarget.target.split(':')[1];
93
+ const executor = projectConfig.targets?.[targetName]?.executor;
94
+ throw new Error(`Cypress Component Testing for Angular requires a webpack-based build target, ` +
95
+ `but the project "${options.project}" uses an esbuild-based executor (${executor}).\n\n` +
96
+ `Cypress only supports webpack as the bundler for Angular component testing.`);
97
+ }
98
+ throw new Error('Unable to find a valid build configuration. Try passing in a target for an Angular app (e.g. --build-target=<project>:<target>[:<configuration>]).');
99
+ }
76
100
  }
77
101
  const ctConfigOptions = {};
78
102
  const projectConfig = (0, devkit_1.readProjectConfiguration)(tree, options.project);
@@ -93,9 +117,4 @@ async function configureCypressCT(tree, options) {
93
117
  const updatedCyConfig = await addDefaultCTConfig(tree.read(cypressConfigPath, 'utf-8'), ctConfigOptions);
94
118
  tree.write(cypressConfigPath, `import { nxComponentTestingPreset } from '@nx/angular/plugins/component-testing';\n${updatedCyConfig}`);
95
119
  }
96
- function assertValidConfig(config) {
97
- if (!config) {
98
- throw new Error('Unable to find a valid build configuration. Try passing in a target for an Angular app. --build-target=<project>:<target>[:<configuration>]');
99
- }
100
- }
101
120
  exports.default = cypressComponentConfiguration;
@@ -1 +1 @@
1
- {"version":3,"file":"update-module-resolution.d.ts","sourceRoot":"","sources":["../../../../../../packages/angular/src/migrations/update-21-2-0/update-module-resolution.ts"],"names":[],"mappings":"AAAA,OAAO,EAAyB,KAAK,IAAI,EAAc,MAAM,YAAY,CAAC;AAW1E,yBAA+B,IAAI,EAAE,IAAI,iBA0BxC"}
1
+ {"version":3,"file":"update-module-resolution.d.ts","sourceRoot":"","sources":["../../../../../../packages/angular/src/migrations/update-21-2-0/update-module-resolution.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,KAAK,IAAI,EAEV,MAAM,YAAY,CAAC;AAkBpB,yBAA+B,IAAI,EAAE,IAAI,iBAqCxC"}
@@ -4,24 +4,37 @@ exports.default = default_1;
4
4
  const devkit_1 = require("@nx/devkit");
5
5
  const targets_1 = require("../../utils/targets");
6
6
  const projects_1 = require("../utils/projects");
7
+ // Common tsconfig file names to account for non-buildable libraries
8
+ const KNOWN_TSCONFIG_FILES = [
9
+ 'tsconfig.json',
10
+ 'tsconfig.lib.json',
11
+ 'tsconfig.spec.json',
12
+ ];
7
13
  async function default_1(tree) {
8
14
  const uniqueTsConfigs = new Set();
9
15
  const projects = await (0, projects_1.getProjectsFilteredByDependencies)([
10
16
  'npm:@angular/core',
11
17
  ]);
12
18
  for (const graphNode of projects) {
19
+ const projectRoot = graphNode.data.root;
20
+ // Add existing known tsconfig files
21
+ for (const tsconfigName of KNOWN_TSCONFIG_FILES) {
22
+ const tsconfigPath = (0, devkit_1.joinPathFragments)(projectRoot, tsconfigName);
23
+ if (tree.exists(tsconfigPath)) {
24
+ uniqueTsConfigs.add(tsconfigPath);
25
+ }
26
+ }
13
27
  for (const [, target] of (0, targets_1.allProjectTargets)(graphNode.data)) {
14
28
  for (const [, options] of (0, targets_1.allTargetOptions)(target)) {
15
- if (typeof options?.tsConfig === 'string') {
29
+ if (typeof options?.tsConfig === 'string' &&
30
+ tree.exists(options.tsConfig)) {
16
31
  uniqueTsConfigs.add(options.tsConfig);
17
32
  }
18
33
  }
19
34
  }
20
35
  }
21
36
  for (const tsConfig of uniqueTsConfigs) {
22
- if (tree.exists(tsConfig)) {
23
- updateModuleResolution(tree, tsConfig);
24
- }
37
+ updateModuleResolution(tree, tsConfig);
25
38
  }
26
39
  await (0, devkit_1.formatFiles)(tree);
27
40
  }