@nx/angular 17.3.1 → 18.0.0-beta.1

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/migrations.json CHANGED
@@ -356,6 +356,12 @@
356
356
  },
357
357
  "description": "Add 'autoprefixer' as dev dependency when '@nx/angular:ng-packagr-lite' or '@nx/angular:package` is used.",
358
358
  "factory": "./src/migrations/update-17-3-0/add-autoprefixer-dependency"
359
+ },
360
+ "add-module-federation-env-var-to-target-defaults": {
361
+ "cli": "nx",
362
+ "version": "18.0.0-beta.0",
363
+ "description": "Add NX_MF_DEV_SERVER_STATIC_REMOTES to inputs for task hashing when '@nx/angular:webpack-browser' is used for Module Federation.",
364
+ "factory": "./src/migrations/update-18-0-0/add-mf-env-var-to-target-defaults"
359
365
  }
360
366
  },
361
367
  "packageJsonUpdates": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nx/angular",
3
- "version": "17.3.1",
3
+ "version": "18.0.0-beta.1",
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": {
@@ -74,20 +74,20 @@
74
74
  "ignore": "^5.0.4",
75
75
  "magic-string": "~0.30.2",
76
76
  "minimatch": "9.0.3",
77
- "semver": "7.5.3",
77
+ "semver": "^7.5.3",
78
78
  "tslib": "^2.3.0",
79
79
  "webpack": "^5.80.0",
80
80
  "webpack-merge": "^5.8.0",
81
- "@nx/devkit": "17.3.1",
82
- "@nx/cypress": "17.3.1",
83
- "@nx/jest": "17.3.1",
84
- "@nx/js": "17.3.1",
85
- "@nx/eslint": "17.3.1",
86
- "@nx/webpack": "17.3.1",
87
- "@nx/web": "17.3.1",
88
- "@nx/workspace": "17.3.1",
81
+ "@nx/devkit": "18.0.0-beta.1",
82
+ "@nx/cypress": "18.0.0-beta.1",
83
+ "@nx/jest": "18.0.0-beta.1",
84
+ "@nx/js": "18.0.0-beta.1",
85
+ "@nx/eslint": "18.0.0-beta.1",
86
+ "@nx/webpack": "18.0.0-beta.1",
87
+ "@nx/web": "18.0.0-beta.1",
88
+ "@nx/workspace": "18.0.0-beta.1",
89
89
  "piscina": "^4.2.1",
90
- "@nrwl/angular": "17.3.1"
90
+ "@nrwl/angular": "18.0.0-beta.1"
91
91
  },
92
92
  "peerDependencies": {
93
93
  "@angular-devkit/build-angular": ">= 15.0.0 < 18.0.0",
@@ -8,6 +8,7 @@ const setup_ssr_1 = require("../setup-ssr/setup-ssr");
8
8
  const setup_tailwind_1 = require("../setup-tailwind/setup-tailwind");
9
9
  const ensure_angular_dependencies_1 = require("../utils/ensure-angular-dependencies");
10
10
  const lib_1 = require("./lib");
11
+ const log_show_project_command_1 = require("@nx/devkit/src/utils/log-show-project-command");
11
12
  async function applicationGenerator(tree, schema) {
12
13
  return await applicationGeneratorInternal(tree, {
13
14
  projectNameAndRootFormat: 'derived',
@@ -68,6 +69,7 @@ async function applicationGeneratorInternal(tree, schema) {
68
69
  }
69
70
  return () => {
70
71
  (0, devkit_1.installPackagesTask)(tree);
72
+ (0, log_show_project_command_1.logShowProjectCommand)(options.name);
71
73
  };
72
74
  }
73
75
  exports.applicationGeneratorInternal = applicationGeneratorInternal;
@@ -8,6 +8,7 @@ const application_1 = require("../application/application");
8
8
  const remote_1 = require("../remote/remote");
9
9
  const setup_mf_1 = require("../setup-mf/setup-mf");
10
10
  const lib_1 = require("./lib");
11
+ const add_mf_env_to_inputs_1 = require("../utils/add-mf-env-to-inputs");
11
12
  async function host(tree, options) {
12
13
  return await hostInternal(tree, {
13
14
  projectNameAndRootFormat: 'derived',
@@ -90,6 +91,7 @@ async function hostInternal(tree, schema) {
90
91
  typescriptConfiguration,
91
92
  });
92
93
  }
94
+ (0, add_mf_env_to_inputs_1.addMfEnvToTargetDefaultInputs)(tree);
93
95
  if (!options.skipFormat) {
94
96
  await (0, devkit_1.formatFiles)(tree);
95
97
  }
@@ -20,6 +20,7 @@ const add_project_1 = require("./lib/add-project");
20
20
  const add_jest_1 = require("../utils/add-jest");
21
21
  const set_generator_defaults_1 = require("./lib/set-generator-defaults");
22
22
  const ensure_angular_dependencies_1 = require("../utils/ensure-angular-dependencies");
23
+ const log_show_project_command_1 = require("@nx/devkit/src/utils/log-show-project-command");
23
24
  async function libraryGenerator(tree, schema) {
24
25
  return await libraryGeneratorInternal(tree, {
25
26
  // provide a default projectNameAndRootFormat to avoid breaking changes
@@ -80,6 +81,7 @@ async function libraryGeneratorInternal(tree, schema) {
80
81
  }
81
82
  return () => {
82
83
  (0, devkit_1.installPackagesTask)(tree);
84
+ (0, log_show_project_command_1.logShowProjectCommand)(libraryOptions.name);
83
85
  };
84
86
  }
85
87
  exports.libraryGeneratorInternal = libraryGeneratorInternal;
@@ -8,6 +8,7 @@ const application_1 = require("../application/application");
8
8
  const setup_mf_1 = require("../setup-mf/setup-mf");
9
9
  const lib_1 = require("./lib");
10
10
  const versions_1 = require("@nx/js/src/utils/versions");
11
+ const add_mf_env_to_inputs_1 = require("../utils/add-mf-env-to-inputs");
11
12
  async function remote(tree, options) {
12
13
  return await remoteInternal(tree, {
13
14
  projectNameAndRootFormat: 'derived',
@@ -68,6 +69,7 @@ async function remoteInternal(tree, schema) {
68
69
  });
69
70
  installTasks.push(ssrInstallTask);
70
71
  }
72
+ (0, add_mf_env_to_inputs_1.addMfEnvToTargetDefaultInputs)(tree);
71
73
  if (!options.skipFormat) {
72
74
  await (0, devkit_1.formatFiles)(tree);
73
75
  }
@@ -0,0 +1,2 @@
1
+ import { type Tree } from '@nx/devkit';
2
+ export declare function addMfEnvToTargetDefaultInputs(tree: Tree): void;
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.addMfEnvToTargetDefaultInputs = void 0;
4
+ const devkit_1 = require("@nx/devkit");
5
+ function addMfEnvToTargetDefaultInputs(tree) {
6
+ const nxJson = (0, devkit_1.readNxJson)(tree);
7
+ const webpackExecutor = '@nx/angular:webpack-browser';
8
+ const mfEnvVar = 'NX_MF_DEV_SERVER_STATIC_REMOTES';
9
+ nxJson.targetDefaults ??= {};
10
+ nxJson.targetDefaults[webpackExecutor] ??= {};
11
+ nxJson.targetDefaults[webpackExecutor].inputs ??= [];
12
+ let mfEnvVarExists = false;
13
+ for (const input of nxJson.targetDefaults[webpackExecutor].inputs) {
14
+ if (typeof input === 'object' && input['env'] === mfEnvVar) {
15
+ mfEnvVarExists = true;
16
+ break;
17
+ }
18
+ }
19
+ if (!mfEnvVarExists) {
20
+ nxJson.targetDefaults[webpackExecutor].inputs.push({ env: mfEnvVar });
21
+ (0, devkit_1.updateNxJson)(tree, nxJson);
22
+ }
23
+ }
24
+ exports.addMfEnvToTargetDefaultInputs = addMfEnvToTargetDefaultInputs;
@@ -0,0 +1,2 @@
1
+ import { type Tree } from '@nx/devkit';
2
+ export default function (tree: Tree): Promise<void>;
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const devkit_1 = require("@nx/devkit");
4
+ const add_mf_env_to_inputs_1 = require("../../generators/utils/add-mf-env-to-inputs");
5
+ async function default_1(tree) {
6
+ if (!isWebpackBrowserUsed(tree)) {
7
+ return;
8
+ }
9
+ (0, add_mf_env_to_inputs_1.addMfEnvToTargetDefaultInputs)(tree);
10
+ await (0, devkit_1.formatFiles)(tree);
11
+ }
12
+ exports.default = default_1;
13
+ function isWebpackBrowserUsed(tree) {
14
+ const projects = (0, devkit_1.getProjects)(tree);
15
+ for (const project of projects.values()) {
16
+ const targets = project.targets;
17
+ for (const [_, target] of Object.entries(targets)) {
18
+ if (target.executor === '@nx/angular:webpack-browser' &&
19
+ (tree.exists((0, devkit_1.joinPathFragments)(project.root, 'module-federation.config.ts')) ||
20
+ tree.exists((0, devkit_1.joinPathFragments)(project.root, 'module-federation.config.js')))) {
21
+ return true;
22
+ }
23
+ }
24
+ }
25
+ return false;
26
+ }