@nx/angular 18.0.4 → 18.0.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": "18.0.4",
3
+ "version": "18.0.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, 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- Upgrading AngularJS applications \n\n- Single Component Application Modules (SCAMs) \n\n- NgRx helpers. \n\n- Utilities for automatic workspace refactoring.",
6
6
  "repository": {
@@ -78,16 +78,16 @@
78
78
  "tslib": "^2.3.0",
79
79
  "webpack": "^5.80.0",
80
80
  "webpack-merge": "^5.8.0",
81
- "@nx/devkit": "18.0.4",
82
- "@nx/cypress": "18.0.4",
83
- "@nx/jest": "18.0.4",
84
- "@nx/js": "18.0.4",
85
- "@nx/eslint": "18.0.4",
86
- "@nx/webpack": "18.0.4",
87
- "@nx/web": "18.0.4",
88
- "@nx/workspace": "18.0.4",
81
+ "@nx/devkit": "18.0.5",
82
+ "@nx/cypress": "18.0.5",
83
+ "@nx/jest": "18.0.5",
84
+ "@nx/js": "18.0.5",
85
+ "@nx/eslint": "18.0.5",
86
+ "@nx/webpack": "18.0.5",
87
+ "@nx/web": "18.0.5",
88
+ "@nx/workspace": "18.0.5",
89
89
  "piscina": "^4.2.1",
90
- "@nrwl/angular": "18.0.4"
90
+ "@nrwl/angular": "18.0.5"
91
91
  },
92
92
  "peerDependencies": {
93
93
  "@angular-devkit/build-angular": ">= 15.0.0 < 18.0.0",
@@ -101,8 +101,10 @@ async function* moduleFederationDevServerExecutor(schema, context) {
101
101
  devkit_1.logger.info(`NX All remotes started, server ready at http://localhost:${options.port}`);
102
102
  next({ success: true, baseUrl: `http://localhost:${options.port}` });
103
103
  }
104
- catch {
105
- throw new Error(`Timed out waiting for remote to start. Check above for any errors.`);
104
+ catch (err) {
105
+ throw new Error(`Failed to start remotes. Check above for any errors.`, {
106
+ cause: err,
107
+ });
106
108
  }
107
109
  finally {
108
110
  done();
@@ -7,6 +7,9 @@
7
7
  "files": [],
8
8
  "include": [],
9
9
  "references": [
10
+ {
11
+ "path": "./tsconfig.editor.json"
12
+ },
10
13
  {
11
14
  "path": "./tsconfig.app.json"
12
15
  }
@@ -699,7 +699,7 @@ import { Component, ViewEncapsulation } from '@angular/core';
699
699
  You can activate distributed tasks executions and caching by
700
700
  running:
701
701
  </p>
702
- <pre>nx connect-to-nx-cloud</pre>
702
+ <pre>nx connect</pre>
703
703
  <a href="https://nx.app/?utm_source=nx-project" target="_blank" rel="noreferrer"> What is Nx Cloud? </a>
704
704
  </div>
705
705
  <a id="nx-repo" class="button-pill rounded shadow" href="https://github.com/nrwl/nx?utm_source=nx-project" target="_blank" rel="noreferrer">
@@ -702,7 +702,7 @@ import { CommonModule } from '@angular/common';
702
702
  You can activate distributed tasks executions and caching by
703
703
  running:
704
704
  </p>
705
- <pre>nx connect-to-nx-cloud</pre>
705
+ <pre>nx connect</pre>
706
706
  <a href="https://nx.app/?utm_source=nx-project" target="_blank" rel="noreferrer"> What is Nx Cloud? </a>
707
707
  </div>
708
708
  <a id="nx-repo" class="button-pill rounded shadow" href="https://github.com/nrwl/nx?utm_source=nx-project" target="_blank" rel="noreferrer">
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.createFiles = void 0;
4
4
  const devkit_1 = require("@nx/devkit");
5
5
  const js_1 = require("@nx/js");
6
- const create_ts_config_1 = require("../../utils/create-ts-config");
6
+ const update_project_root_tsconfig_1 = require("../../utils/update-project-root-tsconfig");
7
7
  const test_runners_1 = require("../../../utils/test-runners");
8
8
  const version_utils_1 = require("../../utils/version-utils");
9
9
  async function createFiles(tree, options, rootOffset) {
@@ -33,13 +33,7 @@ async function createFiles(tree, options, rootOffset) {
33
33
  else {
34
34
  (0, devkit_1.generateFiles)(tree, (0, devkit_1.joinPathFragments)(__dirname, '../files/ng-module'), options.appProjectRoot, substitutions);
35
35
  }
36
- (0, create_ts_config_1.createTsConfig)(tree, options.appProjectRoot, 'app', {
37
- bundler: options.bundler,
38
- rootProject: options.rootProject,
39
- strict: options.strict,
40
- style: options.style,
41
- esModuleInterop: isUsingApplicationBuilder,
42
- }, (0, js_1.getRelativePathToRootTsConfig)(tree, options.appProjectRoot));
36
+ (0, update_project_root_tsconfig_1.updateProjectRootTsConfig)(tree, options.appProjectRoot, (0, js_1.getRelativePathToRootTsConfig)(tree, options.appProjectRoot), options.rootProject);
43
37
  if (!options.routing) {
44
38
  tree.delete((0, devkit_1.joinPathFragments)(options.appProjectRoot, '/src/app/app.routes.ts'));
45
39
  }
@@ -1,3 +1,3 @@
1
- import type { Tree } from '@nx/devkit';
1
+ import { type Tree } from '@nx/devkit';
2
2
  import type { NormalizedSchema } from './normalized-schema';
3
3
  export declare function updateEditorTsConfig(tree: Tree, options: NormalizedSchema): void;
@@ -2,24 +2,21 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.updateEditorTsConfig = void 0;
4
4
  const devkit_1 = require("@nx/devkit");
5
+ const update_app_editor_tsconfig_excluded_files_1 = require("../../utils/update-app-editor-tsconfig-excluded-files");
5
6
  function getCompilerOptionsTypes(tsConfig) {
6
7
  return tsConfig?.compilerOptions?.types ?? [];
7
8
  }
8
9
  function updateEditorTsConfig(tree, options) {
9
- const types = getCompilerOptionsTypes((0, devkit_1.readJson)(tree, (0, devkit_1.joinPathFragments)(options.appProjectRoot, 'tsconfig.app.json')));
10
- if (options.unitTestRunner !== 'none') {
11
- types.push(...getCompilerOptionsTypes((0, devkit_1.readJson)(tree, (0, devkit_1.joinPathFragments)(options.appProjectRoot, 'tsconfig.spec.json'))));
12
- }
13
- (0, devkit_1.updateJson)(tree, (0, devkit_1.joinPathFragments)(options.appProjectRoot, 'tsconfig.editor.json'), (json) => {
14
- json.compilerOptions.types = types;
15
- return json;
16
- });
17
- // This should be the last tsconfig references so it's not in the template
18
- (0, devkit_1.updateJson)(tree, (0, devkit_1.joinPathFragments)(options.appProjectRoot, 'tsconfig.json'), (json) => {
19
- json.references.push({
20
- path: './tsconfig.editor.json',
10
+ const appTsConfig = (0, devkit_1.readJson)(tree, (0, devkit_1.joinPathFragments)(options.appProjectRoot, 'tsconfig.app.json'));
11
+ const types = getCompilerOptionsTypes(appTsConfig);
12
+ if (types?.length) {
13
+ (0, devkit_1.updateJson)(tree, (0, devkit_1.joinPathFragments)(options.appProjectRoot, 'tsconfig.editor.json'), (json) => {
14
+ json.compilerOptions ??= {};
15
+ json.compilerOptions.types = Array.from(new Set(types));
16
+ return json;
21
17
  });
22
- return json;
23
- });
18
+ }
19
+ const project = (0, devkit_1.readProjectConfiguration)(tree, options.name);
20
+ (0, update_app_editor_tsconfig_excluded_files_1.updateAppEditorTsConfigExcludedFiles)(tree, project);
24
21
  }
25
22
  exports.updateEditorTsConfig = updateEditorTsConfig;
@@ -10,6 +10,7 @@ const component_test_1 = require("../component-test/component-test");
10
10
  const component_info_1 = require("../utils/storybook-ast/component-info");
11
11
  const entry_point_1 = require("../utils/storybook-ast/entry-point");
12
12
  const module_info_1 = require("../utils/storybook-ast/module-info");
13
+ const update_app_editor_tsconfig_excluded_files_1 = require("../utils/update-app-editor-tsconfig-excluded-files");
13
14
  function cypressComponentConfiguration(tree, options) {
14
15
  return cypressComponentConfigurationInternal(tree, {
15
16
  addPlugin: false,
@@ -31,6 +32,9 @@ async function cypressComponentConfigurationInternal(tree, options) {
31
32
  });
32
33
  await configureCypressCT(tree, options);
33
34
  await addFiles(tree, projectConfig, options);
35
+ if (projectConfig.projectType === 'application') {
36
+ (0, update_app_editor_tsconfig_excluded_files_1.updateAppEditorTsConfigExcludedFiles)(tree, projectConfig);
37
+ }
34
38
  if (!options.skipFormat) {
35
39
  await (0, devkit_1.formatFiles)(tree);
36
40
  }
@@ -4,10 +4,6 @@ exports.addProject = void 0;
4
4
  const devkit_1 = require("@nx/devkit");
5
5
  const add_build_target_defaults_1 = require("@nx/devkit/src/generators/add-build-target-defaults");
6
6
  function addProject(tree, libraryOptions) {
7
- const executor = libraryOptions.publishable
8
- ? '@nx/angular:package'
9
- : '@nx/angular:ng-packagr-lite';
10
- (0, add_build_target_defaults_1.addBuildTargetDefaults)(tree, executor);
11
7
  const project = {
12
8
  name: libraryOptions.name,
13
9
  root: libraryOptions.projectRoot,
@@ -15,27 +11,30 @@ function addProject(tree, libraryOptions) {
15
11
  prefix: libraryOptions.prefix,
16
12
  tags: libraryOptions.parsedTags,
17
13
  projectType: 'library',
18
- targets: {
19
- build: libraryOptions.buildable || libraryOptions.publishable
20
- ? {
21
- executor,
22
- outputs: ['{workspaceRoot}/dist/{projectRoot}'],
23
- options: {
24
- project: `${libraryOptions.projectRoot}/ng-package.json`,
25
- },
26
- configurations: {
27
- production: {
28
- tsConfig: `${libraryOptions.projectRoot}/tsconfig.lib.prod.json`,
29
- },
30
- development: {
31
- tsConfig: `${libraryOptions.projectRoot}/tsconfig.lib.json`,
32
- },
33
- },
34
- defaultConfiguration: 'production',
35
- }
36
- : undefined,
37
- },
14
+ targets: {},
38
15
  };
16
+ if (libraryOptions.buildable || libraryOptions.publishable) {
17
+ const executor = libraryOptions.publishable
18
+ ? '@nx/angular:package'
19
+ : '@nx/angular:ng-packagr-lite';
20
+ (0, add_build_target_defaults_1.addBuildTargetDefaults)(tree, executor);
21
+ project.targets.build = {
22
+ executor,
23
+ outputs: ['{workspaceRoot}/dist/{projectRoot}'],
24
+ options: {
25
+ project: `${libraryOptions.projectRoot}/ng-package.json`,
26
+ },
27
+ configurations: {
28
+ production: {
29
+ tsConfig: `${libraryOptions.projectRoot}/tsconfig.lib.prod.json`,
30
+ },
31
+ development: {
32
+ tsConfig: `${libraryOptions.projectRoot}/tsconfig.lib.json`,
33
+ },
34
+ },
35
+ defaultConfiguration: 'production',
36
+ };
37
+ }
39
38
  (0, devkit_1.addProjectConfiguration)(tree, libraryOptions.name, project);
40
39
  return project;
41
40
  }
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.updateTsConfig = void 0;
4
4
  const devkit_1 = require("@nx/devkit");
5
5
  const js_1 = require("@nx/js");
6
- const create_ts_config_1 = require("../../utils/create-ts-config");
6
+ const update_project_root_tsconfig_1 = require("../../utils/update-project-root-tsconfig");
7
7
  function updateProjectConfig(host, options) {
8
8
  (0, devkit_1.updateJson)(host, `${options.projectRoot}/tsconfig.lib.json`, (json) => {
9
9
  json.include = ['src/**/*.ts'];
@@ -18,7 +18,7 @@ function updateProjectConfig(host, options) {
18
18
  return json;
19
19
  });
20
20
  // tsconfig.json
21
- (0, create_ts_config_1.createTsConfig)(host, options.projectRoot, 'lib', options, (0, js_1.getRelativePathToRootTsConfig)(host, options.projectRoot));
21
+ (0, update_project_root_tsconfig_1.updateProjectRootTsConfig)(host, options.projectRoot, (0, js_1.getRelativePathToRootTsConfig)(host, options.projectRoot));
22
22
  }
23
23
  function updateProjectIvyConfig(host, options) {
24
24
  if (options.buildable || options.publishable) {
@@ -30,7 +30,7 @@ function updateProjectIvyConfig(host, options) {
30
30
  }
31
31
  }
32
32
  function updateTsConfig(host, options) {
33
- (0, create_ts_config_1.extractTsConfigBase)(host);
33
+ (0, update_project_root_tsconfig_1.extractTsConfigBase)(host);
34
34
  updateProjectConfig(host, options);
35
35
  updateProjectIvyConfig(host, options);
36
36
  }
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.storybookConfigurationGenerator = void 0;
4
4
  const devkit_1 = require("@nx/devkit");
5
+ const update_app_editor_tsconfig_excluded_files_1 = require("../utils/update-app-editor-tsconfig-excluded-files");
5
6
  const assert_compatible_storybook_version_1 = require("./lib/assert-compatible-storybook-version");
6
7
  const generate_stories_1 = require("./lib/generate-stories");
7
8
  const generate_storybook_configuration_1 = require("./lib/generate-storybook-configuration");
@@ -22,6 +23,10 @@ async function storybookConfigurationGenerator(tree, options) {
22
23
  skipFormat: true,
23
24
  });
24
25
  }
26
+ const project = (0, devkit_1.readProjectConfiguration)(tree, options.project);
27
+ if (project.projectType === 'application') {
28
+ (0, update_app_editor_tsconfig_excluded_files_1.updateAppEditorTsConfigExcludedFiles)(tree, project);
29
+ }
25
30
  if (!options.skipFormat) {
26
31
  await (0, devkit_1.formatFiles)(tree);
27
32
  }
@@ -0,0 +1,2 @@
1
+ import { type ProjectConfiguration, type Tree } from '@nx/devkit';
2
+ export declare function updateAppEditorTsConfigExcludedFiles(tree: Tree, projectConfig: ProjectConfiguration): void;
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.updateAppEditorTsConfigExcludedFiles = void 0;
4
+ const devkit_1 = require("@nx/devkit");
5
+ function updateAppEditorTsConfigExcludedFiles(tree, projectConfig) {
6
+ if (projectConfig.projectType !== 'application') {
7
+ return;
8
+ }
9
+ const editorTsConfigPath = (0, devkit_1.joinPathFragments)(projectConfig.root, 'tsconfig.editor.json');
10
+ const appTsConfigPath = (0, devkit_1.joinPathFragments)(projectConfig.root, 'tsconfig.app.json');
11
+ if (!tree.exists(editorTsConfigPath) || !tree.exists(appTsConfigPath)) {
12
+ return;
13
+ }
14
+ const appTsConfig = (0, devkit_1.readJson)(tree, appTsConfigPath);
15
+ (0, devkit_1.updateJson)(tree, editorTsConfigPath, (json) => {
16
+ const exclude = [...(json.exclude ?? []), ...(appTsConfig.exclude ?? [])];
17
+ if (exclude.length) {
18
+ json.exclude = Array.from(new Set(exclude));
19
+ }
20
+ return json;
21
+ });
22
+ }
23
+ exports.updateAppEditorTsConfigExcludedFiles = updateAppEditorTsConfigExcludedFiles;
@@ -0,0 +1,3 @@
1
+ import { type Tree } from '@nx/devkit';
2
+ export { extractTsConfigBase } from '@nx/js';
3
+ export declare function updateProjectRootTsConfig(host: Tree, projectRoot: string, relativePathToRootTsConfig: string, isRootProject?: boolean): void;
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.updateProjectRootTsConfig = exports.extractTsConfigBase = void 0;
4
+ const devkit_1 = require("@nx/devkit");
5
+ const js_1 = require("@nx/js");
6
+ var js_2 = require("@nx/js");
7
+ Object.defineProperty(exports, "extractTsConfigBase", { enumerable: true, get: function () { return js_2.extractTsConfigBase; } });
8
+ function updateProjectRootTsConfig(host, projectRoot, relativePathToRootTsConfig, isRootProject) {
9
+ (0, devkit_1.updateJson)(host, `${projectRoot}/tsconfig.json`, (json) => {
10
+ if (isRootProject) {
11
+ // inline tsconfig.base.json into the project
12
+ json.compileOnSave = false;
13
+ json.compilerOptions = {
14
+ ...js_1.tsConfigBaseOptions,
15
+ ...json.compilerOptions,
16
+ };
17
+ json.exclude = ['node_modules', 'tmp'];
18
+ delete json.extends;
19
+ }
20
+ else {
21
+ json.extends = relativePathToRootTsConfig;
22
+ }
23
+ return json;
24
+ });
25
+ }
26
+ exports.updateProjectRootTsConfig = updateProjectRootTsConfig;
@@ -1,9 +0,0 @@
1
- import type { Tree } from '@nx/devkit';
2
- export { extractTsConfigBase } from '@nx/js';
3
- export declare function createTsConfig(host: Tree, projectRoot: string, type: 'app' | 'lib', options: {
4
- strict?: boolean;
5
- style?: string;
6
- bundler?: string;
7
- rootProject?: boolean;
8
- esModuleInterop?: boolean;
9
- }, relativePathToRootTsConfig: string): void;
@@ -1,34 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.createTsConfig = exports.extractTsConfigBase = void 0;
4
- const devkit_1 = require("@nx/devkit");
5
- const js_1 = require("@nx/js");
6
- var js_2 = require("@nx/js");
7
- Object.defineProperty(exports, "extractTsConfigBase", { enumerable: true, get: function () { return js_2.extractTsConfigBase; } });
8
- function createTsConfig(host, projectRoot, type, options, relativePathToRootTsConfig) {
9
- const json = {
10
- compilerOptions: {
11
- target: 'es2022',
12
- useDefineForClassFields: false,
13
- esModuleInterop: options.esModuleInterop ? true : undefined,
14
- },
15
- files: [],
16
- include: [],
17
- references: [
18
- {
19
- path: type === 'app' ? './tsconfig.app.json' : './tsconfig.lib.json',
20
- },
21
- ],
22
- };
23
- // inline tsconfig.base.json into the project
24
- if (options.rootProject) {
25
- json.compileOnSave = false;
26
- json.compilerOptions = { ...js_1.tsConfigBaseOptions, ...json.compilerOptions };
27
- json.exclude = ['node_modules', 'tmp'];
28
- }
29
- else {
30
- json.extends = relativePathToRootTsConfig;
31
- }
32
- (0, devkit_1.writeJson)(host, `${projectRoot}/tsconfig.json`, json);
33
- }
34
- exports.createTsConfig = createTsConfig;