@nx/angular 24.0.0-pr.37405.acdaf31 → 24.0.0-rc.0
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/dist/executors.d.ts +0 -2
- package/dist/executors.js +0 -2
- package/dist/fesm2022/nx-angular.mjs +0 -4
- package/dist/generators.d.ts +0 -8
- package/dist/generators.js +0 -8
- package/dist/ready-check.d.ts +1 -0
- package/dist/ready-check.js +8 -0
- package/dist/src/executors/application/schema.json +1 -2
- package/dist/src/executors/ng-packagr-lite/ng-packagr-adjustments/ng-package/entry-point/write-bundles.transform.js +9 -1
- package/dist/src/executors/unit-test/schema.json +6 -1
- package/dist/src/executors/unit-test/unit-test.impl.js +5 -0
- package/dist/src/executors/utilities/ng-packagr/stylesheet-processor.js +35 -10
- package/dist/src/generators/add-linting/add-linting.js +1 -3
- package/dist/src/generators/add-linting/schema.d.ts +0 -5
- package/dist/src/generators/add-linting/schema.json +0 -6
- package/dist/src/generators/application/application.js +1 -2
- package/dist/src/generators/application/lib/add-e2e.js +3 -8
- package/dist/src/generators/application/lib/add-linting.js +1 -3
- package/dist/src/generators/application/lib/add-serve-static-target.js +2 -0
- package/dist/src/generators/application/lib/add-unit-test-runner.js +0 -2
- package/dist/src/generators/application/lib/create-project.js +2 -0
- package/dist/src/generators/application/lib/normalize-options.d.ts +1 -1
- package/dist/src/generators/application/lib/normalize-options.js +1 -8
- package/dist/src/generators/application/schema.d.ts +0 -5
- package/dist/src/generators/application/schema.json +1 -7
- package/dist/src/generators/convert-to-rspack/convert-to-rspack.js +9 -4
- package/dist/src/generators/convert-to-rspack/lib/get-custom-webpack-config.d.ts +1 -2
- package/dist/src/generators/convert-to-rspack/lib/get-custom-webpack-config.js +0 -63
- package/dist/src/generators/convert-to-rspack/lib/validate-no-module-federation.d.ts +2 -0
- package/dist/src/generators/convert-to-rspack/lib/validate-no-module-federation.js +32 -0
- package/dist/src/generators/cypress-component-configuration/cypress-component-configuration.js +3 -15
- package/dist/src/generators/init/init.js +1 -2
- package/dist/src/generators/init/schema.d.ts +0 -2
- package/dist/src/generators/library/lib/normalized-schema.d.ts +0 -4
- package/dist/src/generators/library/library.js +3 -4
- package/dist/src/generators/library/schema.d.ts +0 -5
- package/dist/src/generators/library/schema.json +0 -6
- package/dist/src/generators/ng-add/migrators/builders/angular-eslint-lint.migrator.js +12 -1
- package/dist/src/generators/ng-add/migrators/projects/app.migrator.d.ts +1 -0
- package/dist/src/generators/ng-add/migrators/projects/app.migrator.js +22 -0
- package/dist/src/generators/ng-add/migrators/projects/e2e.migrator.js +12 -16
- package/dist/src/generators/ng-add/utilities/workspace.js +1 -3
- package/dist/src/generators/setup-ssr/files/v20+/application-builder/server/__serverFileName__ +15 -1
- package/dist/src/generators/setup-ssr/lib/add-dependencies.js +4 -0
- package/dist/src/generators/setup-ssr/lib/update-project-config.js +1 -0
- package/dist/src/generators/storybook-configuration/lib/generate-storybook-configuration.js +0 -2
- package/dist/src/generators/utils/add-jest.d.ts +0 -1
- package/dist/src/generators/utils/add-jest.js +0 -2
- package/dist/src/generators/utils/add-vitest.d.ts +0 -1
- package/dist/src/generators/utils/add-vitest.js +0 -1
- package/dist/src/generators/utils/testing.d.ts +4 -4
- package/dist/src/generators/utils/testing.js +19 -12
- package/dist/src/migrations/update-23-1-0/add-angular-build.js +7 -3
- package/dist/src/migrations/update-23-1-0/add-angular-build.md +1 -1
- package/dist/src/migrations/update-23-1-0/add-trust-proxy-headers.js +9 -2
- package/dist/src/migrations/update-24-0-0/add-ready-when-signal.d.ts +4 -0
- package/dist/src/migrations/update-24-0-0/add-ready-when-signal.js +12 -0
- package/dist/src/migrations/update-24-0-0/add-ready-when-signal.md +59 -0
- package/dist/src/migrations/update-24-0-0/remove-scam-generator-defaults.d.ts +2 -0
- package/dist/src/migrations/update-24-0-0/remove-scam-generator-defaults.js +85 -0
- package/dist/src/migrations/update-24-0-0/remove-scam-generator-defaults.md +48 -0
- package/dist/src/migrations/update-24-0-0/upgrade-to-angular-22-2.d.ts +5 -0
- package/dist/src/migrations/update-24-0-0/upgrade-to-angular-22-2.js +332 -0
- package/dist/src/migrations/update-24-0-0/upgrade-to-angular-22-2.md +46 -0
- package/dist/src/plugins/plugin.js +3 -5
- package/dist/src/plugins/utils/dev-server-ready-check.d.ts +17 -0
- package/dist/src/plugins/utils/dev-server-ready-check.js +213 -0
- package/dist/src/utils/assert-cypress-component-testing-support.js +10 -0
- package/dist/src/utils/backward-compatible-versions.js +0 -8
- package/dist/src/utils/versions.d.ts +4 -8
- package/dist/src/utils/versions.js +5 -9
- package/dist/types/nx-angular.d.ts +1 -3
- package/executors.json +0 -10
- package/generators.json +0 -59
- package/migrations.json +109 -0
- package/package.json +13 -21
- package/dist/.npmignore +0 -2
- package/dist/fesm2022/nx-angular-mf.mjs +0 -193
- package/dist/fesm2022/nx-angular-mf.mjs.map +0 -1
- package/dist/fesm2022/nx-angular.mjs.map +0 -1
- package/dist/mf/package.json +0 -4
- package/dist/src/builders/utilities/module-federation.d.ts +0 -11
- package/dist/src/builders/utilities/module-federation.js +0 -109
- package/dist/src/executors/module-federation-dev-server/lib/index.d.ts +0 -2
- package/dist/src/executors/module-federation-dev-server/lib/index.js +0 -5
- package/dist/src/executors/module-federation-dev-server/lib/normalize-options.d.ts +0 -2
- package/dist/src/executors/module-federation-dev-server/lib/normalize-options.js +0 -22
- package/dist/src/executors/module-federation-dev-server/lib/start-dev-remotes.d.ts +0 -5
- package/dist/src/executors/module-federation-dev-server/lib/start-dev-remotes.js +0 -29
- package/dist/src/executors/module-federation-dev-server/module-federation-dev-server.impl.d.ts +0 -4
- package/dist/src/executors/module-federation-dev-server/module-federation-dev-server.impl.js +0 -111
- package/dist/src/executors/module-federation-dev-server/schema.d.ts +0 -38
- package/dist/src/executors/module-federation-dev-server/schema.json +0 -171
- package/dist/src/executors/module-federation-ssr-dev-server/lib/normalize-options.d.ts +0 -2
- package/dist/src/executors/module-federation-ssr-dev-server/lib/normalize-options.js +0 -20
- package/dist/src/executors/module-federation-ssr-dev-server/lib/start-dev-remotes.d.ts +0 -5
- package/dist/src/executors/module-federation-ssr-dev-server/lib/start-dev-remotes.js +0 -30
- package/dist/src/executors/module-federation-ssr-dev-server/module-federation-ssr-dev-server.impl.d.ts +0 -4
- package/dist/src/executors/module-federation-ssr-dev-server/module-federation-ssr-dev-server.impl.js +0 -110
- package/dist/src/executors/module-federation-ssr-dev-server/schema.d.ts +0 -17
- package/dist/src/executors/module-federation-ssr-dev-server/schema.json +0 -124
- package/dist/src/generators/convert-to-with-mf/convert-to-with-mf.d.ts +0 -4
- package/dist/src/generators/convert-to-with-mf/convert-to-with-mf.js +0 -36
- package/dist/src/generators/convert-to-with-mf/convert-to-with-mf.test-data.d.ts +0 -5
- package/dist/src/generators/convert-to-with-mf/convert-to-with-mf.test-data.js +0 -448
- package/dist/src/generators/convert-to-with-mf/lib/check-name-matches.d.ts +0 -2
- package/dist/src/generators/convert-to-with-mf/lib/check-name-matches.js +0 -22
- package/dist/src/generators/convert-to-with-mf/lib/check-shared-npm-packages.d.ts +0 -2
- package/dist/src/generators/convert-to-with-mf/lib/check-shared-npm-packages.js +0 -45
- package/dist/src/generators/convert-to-with-mf/lib/get-webpack-config-path.d.ts +0 -2
- package/dist/src/generators/convert-to-with-mf/lib/get-webpack-config-path.js +0 -18
- package/dist/src/generators/convert-to-with-mf/lib/index.d.ts +0 -6
- package/dist/src/generators/convert-to-with-mf/lib/index.js +0 -9
- package/dist/src/generators/convert-to-with-mf/lib/is-host-remote-config.d.ts +0 -5
- package/dist/src/generators/convert-to-with-mf/lib/is-host-remote-config.js +0 -57
- package/dist/src/generators/convert-to-with-mf/lib/parse-ast-webpack-config.d.ts +0 -2
- package/dist/src/generators/convert-to-with-mf/lib/parse-ast-webpack-config.js +0 -13
- package/dist/src/generators/convert-to-with-mf/lib/write-new-webpack-config.d.ts +0 -3
- package/dist/src/generators/convert-to-with-mf/lib/write-new-webpack-config.js +0 -50
- package/dist/src/generators/convert-to-with-mf/schema.d.ts +0 -4
- package/dist/src/generators/convert-to-with-mf/schema.json +0 -33
- package/dist/src/generators/federate-module/federate-module.d.ts +0 -4
- package/dist/src/generators/federate-module/federate-module.js +0 -49
- package/dist/src/generators/federate-module/lib/add-file-to-remote-tsconfig.d.ts +0 -2
- package/dist/src/generators/federate-module/lib/add-file-to-remote-tsconfig.js +0 -14
- package/dist/src/generators/federate-module/lib/add-path-to-exposes.d.ts +0 -8
- package/dist/src/generators/federate-module/lib/add-path-to-exposes.js +0 -77
- package/dist/src/generators/federate-module/lib/add-path-to-ts-config.d.ts +0 -8
- package/dist/src/generators/federate-module/lib/add-path-to-ts-config.js +0 -11
- package/dist/src/generators/federate-module/lib/add-remote.d.ts +0 -7
- package/dist/src/generators/federate-module/lib/add-remote.js +0 -42
- package/dist/src/generators/federate-module/lib/check-remote-exists.d.ts +0 -2
- package/dist/src/generators/federate-module/lib/check-remote-exists.js +0 -21
- package/dist/src/generators/federate-module/lib/index.d.ts +0 -4
- package/dist/src/generators/federate-module/lib/index.js +0 -7
- package/dist/src/generators/federate-module/schema.d.ts +0 -13
- package/dist/src/generators/federate-module/schema.json +0 -83
- package/dist/src/generators/host/files/common/src/main.server.ts__tmpl__ +0 -78
- package/dist/src/generators/host/files/js/webpack.server.config.js__tmpl__ +0 -8
- package/dist/src/generators/host/files/ts/webpack.server.config.ts__tmpl__ +0 -9
- package/dist/src/generators/host/host.d.ts +0 -4
- package/dist/src/generators/host/host.js +0 -133
- package/dist/src/generators/host/lib/index.d.ts +0 -2
- package/dist/src/generators/host/lib/index.js +0 -5
- package/dist/src/generators/host/lib/update-ssr-setup.d.ts +0 -3
- package/dist/src/generators/host/lib/update-ssr-setup.js +0 -54
- package/dist/src/generators/host/lib/validate-options.d.ts +0 -3
- package/dist/src/generators/host/lib/validate-options.js +0 -12
- package/dist/src/generators/host/schema.d.ts +0 -36
- package/dist/src/generators/host/schema.json +0 -195
- package/dist/src/generators/remote/files/base/webpack.server.config.js__tmpl__ +0 -9
- package/dist/src/generators/remote/files/base-ts/webpack.server.config.ts__tmpl__ +0 -9
- package/dist/src/generators/remote/files/common/src/main.server.ts__tmpl__ +0 -84
- package/dist/src/generators/remote/files/standalone/src/bootstrap.server.ts__tmpl__ +0 -12
- package/dist/src/generators/remote/lib/find-next-available-port.d.ts +0 -2
- package/dist/src/generators/remote/lib/find-next-available-port.js +0 -16
- package/dist/src/generators/remote/lib/index.d.ts +0 -3
- package/dist/src/generators/remote/lib/index.js +0 -6
- package/dist/src/generators/remote/lib/update-ssr-setup.d.ts +0 -9
- package/dist/src/generators/remote/lib/update-ssr-setup.js +0 -82
- package/dist/src/generators/remote/lib/validate-options.d.ts +0 -3
- package/dist/src/generators/remote/lib/validate-options.js +0 -12
- package/dist/src/generators/remote/remote.d.ts +0 -4
- package/dist/src/generators/remote/remote.js +0 -114
- package/dist/src/generators/remote/schema.d.ts +0 -34
- package/dist/src/generators/remote/schema.json +0 -184
- package/dist/src/generators/scam/lib/convert-component-to-scam.d.ts +0 -3
- package/dist/src/generators/scam/lib/convert-component-to-scam.js +0 -41
- package/dist/src/generators/scam/lib/index.d.ts +0 -2
- package/dist/src/generators/scam/lib/index.js +0 -5
- package/dist/src/generators/scam/lib/normalize-options.d.ts +0 -3
- package/dist/src/generators/scam/lib/normalize-options.js +0 -34
- package/dist/src/generators/scam/scam.d.ts +0 -7
- package/dist/src/generators/scam/scam.js +0 -28
- package/dist/src/generators/scam/schema.d.ts +0 -30
- package/dist/src/generators/scam/schema.json +0 -126
- package/dist/src/generators/scam-directive/lib/convert-directive-to-scam.d.ts +0 -3
- package/dist/src/generators/scam-directive/lib/convert-directive-to-scam.js +0 -41
- package/dist/src/generators/scam-directive/lib/index.d.ts +0 -2
- package/dist/src/generators/scam-directive/lib/index.js +0 -5
- package/dist/src/generators/scam-directive/lib/normalize-options.d.ts +0 -3
- package/dist/src/generators/scam-directive/lib/normalize-options.js +0 -34
- package/dist/src/generators/scam-directive/scam-directive.d.ts +0 -7
- package/dist/src/generators/scam-directive/scam-directive.js +0 -28
- package/dist/src/generators/scam-directive/schema.d.ts +0 -23
- package/dist/src/generators/scam-directive/schema.json +0 -89
- package/dist/src/generators/scam-pipe/lib/convert-pipe-to-scam.d.ts +0 -3
- package/dist/src/generators/scam-pipe/lib/convert-pipe-to-scam.js +0 -41
- package/dist/src/generators/scam-pipe/lib/index.d.ts +0 -2
- package/dist/src/generators/scam-pipe/lib/index.js +0 -5
- package/dist/src/generators/scam-pipe/lib/normalize-options.d.ts +0 -3
- package/dist/src/generators/scam-pipe/lib/normalize-options.js +0 -36
- package/dist/src/generators/scam-pipe/scam-pipe.d.ts +0 -7
- package/dist/src/generators/scam-pipe/scam-pipe.js +0 -28
- package/dist/src/generators/scam-pipe/schema.d.ts +0 -21
- package/dist/src/generators/scam-pipe/schema.json +0 -67
- package/dist/src/generators/scam-to-standalone/lib/convert-scam-to-standalone.d.ts +0 -3
- package/dist/src/generators/scam-to-standalone/lib/convert-scam-to-standalone.js +0 -35
- package/dist/src/generators/scam-to-standalone/lib/get-component-data-from-ast.d.ts +0 -6
- package/dist/src/generators/scam-to-standalone/lib/get-component-data-from-ast.js +0 -15
- package/dist/src/generators/scam-to-standalone/lib/get-module-metadata-from-ast.d.ts +0 -9
- package/dist/src/generators/scam-to-standalone/lib/get-module-metadata-from-ast.js +0 -51
- package/dist/src/generators/scam-to-standalone/lib/get-target-project.d.ts +0 -2
- package/dist/src/generators/scam-to-standalone/lib/get-target-project.js +0 -13
- package/dist/src/generators/scam-to-standalone/lib/index.d.ts +0 -8
- package/dist/src/generators/scam-to-standalone/lib/index.js +0 -11
- package/dist/src/generators/scam-to-standalone/lib/replace-module-usages-with-component.d.ts +0 -2
- package/dist/src/generators/scam-to-standalone/lib/replace-module-usages-with-component.js +0 -20
- package/dist/src/generators/scam-to-standalone/lib/selector-exists-in-ast.d.ts +0 -2
- package/dist/src/generators/scam-to-standalone/lib/selector-exists-in-ast.js +0 -7
- package/dist/src/generators/scam-to-standalone/lib/verify-is-inline-scam.d.ts +0 -2
- package/dist/src/generators/scam-to-standalone/lib/verify-is-inline-scam.js +0 -10
- package/dist/src/generators/scam-to-standalone/lib/verify-module-is-scam.d.ts +0 -1
- package/dist/src/generators/scam-to-standalone/lib/verify-module-is-scam.js +0 -11
- package/dist/src/generators/scam-to-standalone/scam-to-standalone.d.ts +0 -7
- package/dist/src/generators/scam-to-standalone/scam-to-standalone.js +0 -31
- package/dist/src/generators/scam-to-standalone/schema.d.ts +0 -5
- package/dist/src/generators/scam-to-standalone/schema.json +0 -32
- package/dist/src/generators/setup-mf/files/entry-module-files/__entryModuleFileName__.ts__tmpl__ +0 -18
- package/dist/src/generators/setup-mf/files/entry-module-files/entry.routes.ts__tmpl__ +0 -4
- package/dist/src/generators/setup-mf/files/entry-module-files/entry__componentFileSuffix__.ts__tmpl__ +0 -10
- package/dist/src/generators/setup-mf/files/host-files/__appFileName__.spec.ts__tmpl__ +0 -42
- package/dist/src/generators/setup-mf/files/standalone-entry-component-files/entry.routes.ts__tmpl__ +0 -4
- package/dist/src/generators/setup-mf/files/standalone-entry-component-files/entry__componentFileSuffix__.ts__tmpl__ +0 -11
- package/dist/src/generators/setup-mf/files/ts-webpack/module-federation.config.ts__tmpl__ +0 -27
- package/dist/src/generators/setup-mf/files/ts-webpack/tsconfig.lint.json__tmpl__ +0 -12
- package/dist/src/generators/setup-mf/files/ts-webpack/webpack.config.ts__tmpl__ +0 -9
- package/dist/src/generators/setup-mf/files/ts-webpack/webpack.prod.config.ts__tmpl__ +0 -21
- package/dist/src/generators/setup-mf/files/webpack/module-federation.config.js__tmpl__ +0 -23
- package/dist/src/generators/setup-mf/files/webpack/webpack.config.js__tmpl__ +0 -9
- package/dist/src/generators/setup-mf/files/webpack/webpack.prod.config.js__tmpl__ +0 -21
- package/dist/src/generators/setup-mf/lib/add-cypress-workaround.d.ts +0 -3
- package/dist/src/generators/setup-mf/lib/add-cypress-workaround.js +0 -52
- package/dist/src/generators/setup-mf/lib/add-remote-entry.d.ts +0 -3
- package/dist/src/generators/setup-mf/lib/add-remote-entry.js +0 -27
- package/dist/src/generators/setup-mf/lib/add-remote-to-host.d.ts +0 -9
- package/dist/src/generators/setup-mf/lib/add-remote-to-host.js +0 -127
- package/dist/src/generators/setup-mf/lib/change-build-target.d.ts +0 -3
- package/dist/src/generators/setup-mf/lib/change-build-target.js +0 -24
- package/dist/src/generators/setup-mf/lib/fix-bootstrap.d.ts +0 -3
- package/dist/src/generators/setup-mf/lib/fix-bootstrap.js +0 -40
- package/dist/src/generators/setup-mf/lib/generate-config.d.ts +0 -6
- package/dist/src/generators/setup-mf/lib/generate-config.js +0 -32
- package/dist/src/generators/setup-mf/lib/get-remotes-with-ports.d.ts +0 -6
- package/dist/src/generators/setup-mf/lib/get-remotes-with-ports.js +0 -20
- package/dist/src/generators/setup-mf/lib/index.d.ts +0 -15
- package/dist/src/generators/setup-mf/lib/index.js +0 -18
- package/dist/src/generators/setup-mf/lib/move-angular-plugin-to-dependencies.d.ts +0 -2
- package/dist/src/generators/setup-mf/lib/move-angular-plugin-to-dependencies.js +0 -15
- package/dist/src/generators/setup-mf/lib/normalize-options.d.ts +0 -3
- package/dist/src/generators/setup-mf/lib/normalize-options.js +0 -26
- package/dist/src/generators/setup-mf/lib/remove-dead-code-from-remote.d.ts +0 -3
- package/dist/src/generators/setup-mf/lib/remove-dead-code-from-remote.js +0 -61
- package/dist/src/generators/setup-mf/lib/setup-host-if-dynamic.d.ts +0 -3
- package/dist/src/generators/setup-mf/lib/setup-host-if-dynamic.js +0 -20
- package/dist/src/generators/setup-mf/lib/setup-serve-target.d.ts +0 -3
- package/dist/src/generators/setup-mf/lib/setup-serve-target.js +0 -39
- package/dist/src/generators/setup-mf/lib/setup-tspath-for-remote.d.ts +0 -3
- package/dist/src/generators/setup-mf/lib/setup-tspath-for-remote.js +0 -15
- package/dist/src/generators/setup-mf/lib/update-host-app-routes.d.ts +0 -3
- package/dist/src/generators/setup-mf/lib/update-host-app-routes.js +0 -39
- package/dist/src/generators/setup-mf/lib/update-tsconfig.d.ts +0 -3
- package/dist/src/generators/setup-mf/lib/update-tsconfig.js +0 -18
- package/dist/src/generators/setup-mf/schema.d.ts +0 -35
- package/dist/src/generators/setup-mf/schema.json +0 -99
- package/dist/src/generators/setup-mf/setup-mf.d.ts +0 -4
- package/dist/src/generators/setup-mf/setup-mf.js +0 -90
- package/dist/src/generators/utils/add-mf-env-to-inputs.d.ts +0 -2
- package/dist/src/generators/utils/add-mf-env-to-inputs.js +0 -36
- package/dist/src/generators/utils/assert-mf-utils.d.ts +0 -1
- package/dist/src/generators/utils/assert-mf-utils.js +0 -8
- package/dist/src/generators/utils/export-scam.d.ts +0 -11
- package/dist/src/generators/utils/export-scam.js +0 -35
- package/dist/src/utils/get-mf-projects.d.ts +0 -4
- package/dist/src/utils/get-mf-projects.js +0 -31
- package/dist/src/utils/module-federation-deprecation.d.ts +0 -4
- package/dist/src/utils/module-federation-deprecation.js +0 -29
- package/dist/types/nx-angular-mf.d.ts +0 -72
- package/dist/types/nx-angular-mf.d.ts.map +0 -1
- package/dist/types/nx-angular.d.ts.map +0 -1
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.default = update;
|
|
4
|
+
const internal_1 = require("@nx/devkit/internal");
|
|
5
|
+
async function update(tree) {
|
|
6
|
+
return (0, internal_1.addReadyWhenSignalToTargets)(tree, [
|
|
7
|
+
'@angular/build:dev-server',
|
|
8
|
+
'@angular-devkit/build-angular:dev-server',
|
|
9
|
+
'@angular-devkit/build-angular:ssr-dev-server',
|
|
10
|
+
'@nx/angular:dev-server',
|
|
11
|
+
]);
|
|
12
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
#### Report when Angular dev server targets are ready
|
|
2
|
+
|
|
3
|
+
Nx now knows when the Angular dev server builders are listening.
|
|
4
|
+
Nx listens for that report only on targets that set `readyWhen: { signal: true }`.
|
|
5
|
+
Tasks that depend on such a target with `waitFor: 'ready'` then start once the server is listening, instead of as soon as the target starts.
|
|
6
|
+
|
|
7
|
+
This migration sets `readyWhen: { signal: true }` on every target in your projects that uses one of these builders:
|
|
8
|
+
|
|
9
|
+
- `@angular/build:dev-server`
|
|
10
|
+
- `@angular-devkit/build-angular:dev-server`
|
|
11
|
+
- `@angular-devkit/build-angular:ssr-dev-server`
|
|
12
|
+
- `@nx/angular:dev-server`
|
|
13
|
+
|
|
14
|
+
A target without its own `executor` is updated too when a `targetDefaults` entry in `nx.json` gives it one of these builders.
|
|
15
|
+
|
|
16
|
+
The migration leaves a target unchanged in these cases:
|
|
17
|
+
|
|
18
|
+
- The target already sets `readyWhen`, including `null`.
|
|
19
|
+
- The target sets `continuous: false`, or sets no `continuous` and the `targetDefaults` entry that applies to it sets `continuous: false`. Nx only checks readiness for continuous targets.
|
|
20
|
+
- The `targetDefaults` entry that applies to the target sets `readyWhen`.
|
|
21
|
+
|
|
22
|
+
#### Sample code changes
|
|
23
|
+
|
|
24
|
+
##### Before
|
|
25
|
+
|
|
26
|
+
```json title="apps/app1/project.json"
|
|
27
|
+
{
|
|
28
|
+
// ...
|
|
29
|
+
"targets": {
|
|
30
|
+
"serve": {
|
|
31
|
+
"continuous": true,
|
|
32
|
+
"executor": "@angular/build:dev-server",
|
|
33
|
+
"options": {
|
|
34
|
+
"buildTarget": "app1:build"
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
##### After
|
|
42
|
+
|
|
43
|
+
```json title="apps/app1/project.json" {10-12}
|
|
44
|
+
{
|
|
45
|
+
// ...
|
|
46
|
+
"targets": {
|
|
47
|
+
"serve": {
|
|
48
|
+
"continuous": true,
|
|
49
|
+
"executor": "@angular/build:dev-server",
|
|
50
|
+
"options": {
|
|
51
|
+
"buildTarget": "app1:build"
|
|
52
|
+
},
|
|
53
|
+
"readyWhen": {
|
|
54
|
+
"signal": true
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
```
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.default = default_1;
|
|
4
|
+
const devkit_1 = require("@nx/devkit");
|
|
5
|
+
const COLLECTION = '@nx/angular';
|
|
6
|
+
const REMOVED_GENERATORS = [
|
|
7
|
+
'scam',
|
|
8
|
+
'scam-directive',
|
|
9
|
+
'scam-pipe',
|
|
10
|
+
'scam-to-standalone',
|
|
11
|
+
];
|
|
12
|
+
async function default_1(tree) {
|
|
13
|
+
const nxJson = (0, devkit_1.readNxJson)(tree);
|
|
14
|
+
if (nxJson && removeGeneratorDefaults(nxJson)) {
|
|
15
|
+
(0, devkit_1.updateNxJson)(tree, nxJson);
|
|
16
|
+
}
|
|
17
|
+
const angularJsonProjects = removeAngularJsonGeneratorDefaults(tree);
|
|
18
|
+
for (const [projectName, project] of (0, devkit_1.getProjects)(tree)) {
|
|
19
|
+
// updateProjectConfiguration can't write angular.json projects.
|
|
20
|
+
if (angularJsonProjects.has(projectName)) {
|
|
21
|
+
continue;
|
|
22
|
+
}
|
|
23
|
+
if (removeGeneratorDefaults(project)) {
|
|
24
|
+
(0, devkit_1.updateProjectConfiguration)(tree, projectName, project);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
await (0, devkit_1.formatFiles)(tree);
|
|
28
|
+
return { skipAgentic: true };
|
|
29
|
+
}
|
|
30
|
+
function removeAngularJsonGeneratorDefaults(tree) {
|
|
31
|
+
if (!tree.exists('angular.json')) {
|
|
32
|
+
return new Set();
|
|
33
|
+
}
|
|
34
|
+
const angularJson = (0, devkit_1.readJson)(tree, 'angular.json');
|
|
35
|
+
const projects = isRecord(angularJson.projects)
|
|
36
|
+
? angularJson.projects
|
|
37
|
+
: {};
|
|
38
|
+
let changed = false;
|
|
39
|
+
for (const project of Object.values(projects)) {
|
|
40
|
+
if (!isRecord(project)) {
|
|
41
|
+
continue;
|
|
42
|
+
}
|
|
43
|
+
// The Angular CLI uses `schematics`, and Nx also reads `generators`.
|
|
44
|
+
for (const key of ['schematics', 'generators']) {
|
|
45
|
+
const config = { generators: project[key] };
|
|
46
|
+
if (removeGeneratorDefaults(config)) {
|
|
47
|
+
project[key] = config.generators;
|
|
48
|
+
changed = true;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
if (changed) {
|
|
53
|
+
(0, devkit_1.writeJson)(tree, 'angular.json', angularJson);
|
|
54
|
+
}
|
|
55
|
+
return new Set(Object.keys(projects));
|
|
56
|
+
}
|
|
57
|
+
function removeGeneratorDefaults(config) {
|
|
58
|
+
const { generators } = config;
|
|
59
|
+
if (!isRecord(generators)) {
|
|
60
|
+
return false;
|
|
61
|
+
}
|
|
62
|
+
let changed = removeKeys(generators, REMOVED_GENERATORS.map((generator) => `${COLLECTION}:${generator}`));
|
|
63
|
+
const collection = generators[COLLECTION];
|
|
64
|
+
if (isRecord(collection) && removeKeys(collection, REMOVED_GENERATORS)) {
|
|
65
|
+
changed = true;
|
|
66
|
+
if (Object.keys(collection).length === 0) {
|
|
67
|
+
delete generators[COLLECTION];
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
if (changed && Object.keys(generators).length === 0) {
|
|
71
|
+
// `delete` would keep the old value: updateProjectConfiguration merges into package.json `nx`.
|
|
72
|
+
config.generators = undefined;
|
|
73
|
+
}
|
|
74
|
+
return changed;
|
|
75
|
+
}
|
|
76
|
+
function removeKeys(obj, keys) {
|
|
77
|
+
const presentKeys = keys.filter((key) => key in obj);
|
|
78
|
+
for (const key of presentKeys) {
|
|
79
|
+
delete obj[key];
|
|
80
|
+
}
|
|
81
|
+
return presentKeys.length > 0;
|
|
82
|
+
}
|
|
83
|
+
function isRecord(value) {
|
|
84
|
+
return typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
85
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
#### Remove defaults for the removed SCAM generators
|
|
2
|
+
|
|
3
|
+
Nx v24 removes the generators that created and converted single component Angular modules (SCAMs):
|
|
4
|
+
|
|
5
|
+
- `@nx/angular:scam`
|
|
6
|
+
- `@nx/angular:scam-directive`
|
|
7
|
+
- `@nx/angular:scam-pipe`
|
|
8
|
+
- `@nx/angular:scam-to-standalone`
|
|
9
|
+
|
|
10
|
+
Nx no longer reads generator defaults set for them.
|
|
11
|
+
This migration removes those defaults from `nx.json` and from the configuration of every project, including projects defined in `angular.json`.
|
|
12
|
+
It handles both the `"@nx/angular:scam"` key form and the nested `"@nx/angular": { "scam": {} }` form.
|
|
13
|
+
When the removal leaves the `@nx/angular` entry or the whole `generators` object (`schematics` in `angular.json`) empty, the migration removes it too.
|
|
14
|
+
|
|
15
|
+
The migration doesn't change commands or scripts that run these generators.
|
|
16
|
+
Use the `@nx/angular:component`, `@nx/angular:directive`, or `@nx/angular:pipe` generators instead.
|
|
17
|
+
|
|
18
|
+
#### Sample code changes
|
|
19
|
+
|
|
20
|
+
##### Before
|
|
21
|
+
|
|
22
|
+
```json title="nx.json"
|
|
23
|
+
{
|
|
24
|
+
"generators": {
|
|
25
|
+
"@nx/angular:component": {
|
|
26
|
+
"type": "component"
|
|
27
|
+
},
|
|
28
|
+
"@nx/angular:scam": {
|
|
29
|
+
"type": "component"
|
|
30
|
+
},
|
|
31
|
+
"@nx/angular:scam-directive": {
|
|
32
|
+
"type": "directive"
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
##### After
|
|
39
|
+
|
|
40
|
+
```json title="nx.json"
|
|
41
|
+
{
|
|
42
|
+
"generators": {
|
|
43
|
+
"@nx/angular:component": {
|
|
44
|
+
"type": "component"
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
```
|
|
@@ -0,0 +1,332 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.default = upgradeToAngular222;
|
|
4
|
+
const devkit_1 = require("@nx/devkit");
|
|
5
|
+
const internal_1 = require("@nx/devkit/internal");
|
|
6
|
+
const internal_2 = require("@nx/js/internal");
|
|
7
|
+
const path_1 = require("path");
|
|
8
|
+
// Keep these versions pinned; versions.ts advances to later Angular versions.
|
|
9
|
+
const ANGULAR_22_2_VERSIONS = {
|
|
10
|
+
'@angular/core': '~22.2.0',
|
|
11
|
+
'@angular/animations': '~22.2.0',
|
|
12
|
+
'@angular/common': '~22.2.0',
|
|
13
|
+
'@angular/compiler': '~22.2.0',
|
|
14
|
+
'@angular/compiler-cli': '~22.2.0',
|
|
15
|
+
'@angular/elements': '~22.2.0',
|
|
16
|
+
'@angular/forms': '~22.2.0',
|
|
17
|
+
'@angular/language-service': '~22.2.0',
|
|
18
|
+
'@angular/localize': '~22.2.0',
|
|
19
|
+
'@angular/platform-browser': '~22.2.0',
|
|
20
|
+
'@angular/platform-browser-dynamic': '~22.2.0',
|
|
21
|
+
'@angular/platform-server': '~22.2.0',
|
|
22
|
+
'@angular/router': '~22.2.0',
|
|
23
|
+
'@angular/service-worker': '~22.2.0',
|
|
24
|
+
'@angular/upgrade': '~22.2.0',
|
|
25
|
+
'@angular/cli': '~22.2.0',
|
|
26
|
+
'@angular/build': '~22.2.0',
|
|
27
|
+
'@angular/pwa': '~22.2.0',
|
|
28
|
+
'@angular/ssr': '~22.2.0',
|
|
29
|
+
'@angular-devkit/build-angular': '~22.2.0',
|
|
30
|
+
'@angular-devkit/core': '~22.2.0',
|
|
31
|
+
'@angular-devkit/schematics': '~22.2.0',
|
|
32
|
+
'@angular-devkit/architect': '~0.2202.0',
|
|
33
|
+
'@angular-devkit/build-webpack': '~0.2202.0',
|
|
34
|
+
'@schematics/angular': '~22.2.0',
|
|
35
|
+
'@angular/aria': '~22.2.0',
|
|
36
|
+
'@angular/cdk': '~22.2.0',
|
|
37
|
+
'@angular/cdk-experimental': '~22.2.0',
|
|
38
|
+
'@angular/google-maps': '~22.2.0',
|
|
39
|
+
'@angular/material': '~22.2.0',
|
|
40
|
+
'@angular/material-date-fns-adapter': '~22.2.0',
|
|
41
|
+
'@angular/material-experimental': '~22.2.0',
|
|
42
|
+
'@angular/material-luxon-adapter': '~22.2.0',
|
|
43
|
+
'@angular/material-moment-adapter': '~22.2.0',
|
|
44
|
+
'ng-packagr': '~22.2.0',
|
|
45
|
+
'zone.js': '~0.16.2',
|
|
46
|
+
};
|
|
47
|
+
const COMPONENT_TESTING_SPECIFIER = /^(@?cypress\/angular|@nx\/angular\/plugins\/component-testing$)/;
|
|
48
|
+
const MODULE_FEDERATION_SPECIFIER = /^(@module-federation\/(enhanced|node)|@nx\/module-federation|@nx\/angular\/(mf|module-federation))(\/|$)/;
|
|
49
|
+
const MARKER_TEXT = /cypress\/angular|module-federation|@nx\/angular\/(mf|plugins\/component-testing)/;
|
|
50
|
+
const NX_WEBPACK_EXECUTORS = new Set([
|
|
51
|
+
'@nx/angular:webpack-browser',
|
|
52
|
+
'@nx/angular:webpack-server',
|
|
53
|
+
'@nx/angular:module-federation-dev-server',
|
|
54
|
+
'@nx/angular:module-federation-dev-ssr',
|
|
55
|
+
]);
|
|
56
|
+
const WEBPACK_CONFIG_FILE = /^(webpack[\w.-]*|module-federation\.config)\.[cm]?[jt]s$/;
|
|
57
|
+
const RESOLVE_EXTENSIONS = ['.ts', '.js', '.mjs', '.cjs', '.mts', '.cts'];
|
|
58
|
+
const DEPENDENCY_FIELDS = [
|
|
59
|
+
'dependencies',
|
|
60
|
+
'devDependencies',
|
|
61
|
+
'optionalDependencies',
|
|
62
|
+
'peerDependencies',
|
|
63
|
+
];
|
|
64
|
+
let ts;
|
|
65
|
+
async function upgradeToAngular222(tree) {
|
|
66
|
+
const scan = scanWorkspace(tree);
|
|
67
|
+
const unresolved = [];
|
|
68
|
+
const moduleFederationConfigs = findModuleFederationConfigs(tree, scan, unresolved);
|
|
69
|
+
const reasons = [];
|
|
70
|
+
if (scan.componentTestingFiles.length > 0) {
|
|
71
|
+
reasons.push(`Cypress component testing (${scan.componentTestingFiles.join(', ')}) fails with the webpack-dev-server 6 that Angular 22.2 installs (https://github.com/cypress-io/cypress/issues/34259)`);
|
|
72
|
+
}
|
|
73
|
+
if (moduleFederationConfigs.length > 0) {
|
|
74
|
+
reasons.push(`Module Federation builds (${moduleFederationConfigs.join(', ')}) fail with the webpack 5.111 that Angular 22.2 installs (https://github.com/module-federation/core/issues/5077)`);
|
|
75
|
+
}
|
|
76
|
+
else if (unresolved.length > 0 && scan.moduleFederationFiles.length > 0) {
|
|
77
|
+
reasons.push(`Module Federation fails with the webpack 5.111 that Angular 22.2 installs (https://github.com/module-federation/core/issues/5077). ${scan.moduleFederationFiles.join(', ')} import it, and the migration could not tell whether an Angular webpack build does: ${unresolved.join('; ')}`);
|
|
78
|
+
}
|
|
79
|
+
if (reasons.length > 0) {
|
|
80
|
+
const nextSteps = [
|
|
81
|
+
`Kept Angular 22.1. ${reasons.join('. ')}. A later Nx migration updates Angular once these issues are fixed. To update before then, move the Angular packages to 22.2 by hand and work around the issues.`,
|
|
82
|
+
];
|
|
83
|
+
return { nextSteps, agentContext: nextSteps };
|
|
84
|
+
}
|
|
85
|
+
const declared = (0, devkit_1.readJson)(tree, 'package.json');
|
|
86
|
+
const { '@angular/core': core, ...others } = ANGULAR_22_2_VERSIONS;
|
|
87
|
+
// `@angular/core` goes to `dependencies` when the root does not declare it.
|
|
88
|
+
(0, devkit_1.addDependenciesToPackageJson)(tree, { '@angular/core': core }, Object.fromEntries(Object.entries(others).filter(([name]) => declared.dependencies?.[name] || declared.devDependencies?.[name])));
|
|
89
|
+
}
|
|
90
|
+
function scanWorkspace(tree) {
|
|
91
|
+
const scan = {
|
|
92
|
+
angularJsonPaths: [],
|
|
93
|
+
workspacePackages: new Set(),
|
|
94
|
+
declaredDependencies: new Map(),
|
|
95
|
+
componentTestingFiles: [],
|
|
96
|
+
moduleFederationFiles: [],
|
|
97
|
+
};
|
|
98
|
+
// Shared support libraries and config helpers can hold the imports, so the
|
|
99
|
+
// whole workspace is scanned.
|
|
100
|
+
(0, devkit_1.visitNotIgnoredFiles)(tree, '.', (filePath) => {
|
|
101
|
+
const fileName = (0, path_1.basename)(filePath);
|
|
102
|
+
if (fileName === 'angular.json') {
|
|
103
|
+
scan.angularJsonPaths.push(filePath);
|
|
104
|
+
return;
|
|
105
|
+
}
|
|
106
|
+
if (fileName === 'package.json') {
|
|
107
|
+
// Installs fail on a workspace package.json that doesn't parse, so
|
|
108
|
+
// skipping one loses no installed or linked package.
|
|
109
|
+
try {
|
|
110
|
+
const packageJson = (0, devkit_1.readJson)(tree, filePath);
|
|
111
|
+
if (typeof packageJson.name === 'string') {
|
|
112
|
+
scan.workspacePackages.add(packageJson.name);
|
|
113
|
+
}
|
|
114
|
+
scan.declaredDependencies.set((0, path_1.dirname)(filePath), new Set(DEPENDENCY_FIELDS.flatMap((field) => Object.keys(packageJson[field] ?? {}))));
|
|
115
|
+
}
|
|
116
|
+
catch { }
|
|
117
|
+
return;
|
|
118
|
+
}
|
|
119
|
+
if (!/\.[cm]?[jt]sx?$/.test(filePath)) {
|
|
120
|
+
return;
|
|
121
|
+
}
|
|
122
|
+
const content = tree.read(filePath, 'utf-8');
|
|
123
|
+
if (!MARKER_TEXT.test(content)) {
|
|
124
|
+
return;
|
|
125
|
+
}
|
|
126
|
+
const { specifiers } = readModuleSpecifiers(filePath, content);
|
|
127
|
+
if (specifiers.some((s) => COMPONENT_TESTING_SPECIFIER.test(s))) {
|
|
128
|
+
scan.componentTestingFiles.push(filePath);
|
|
129
|
+
}
|
|
130
|
+
if (specifiers.some((s) => MODULE_FEDERATION_SPECIFIER.test(s))) {
|
|
131
|
+
scan.moduleFederationFiles.push(filePath);
|
|
132
|
+
}
|
|
133
|
+
});
|
|
134
|
+
return scan;
|
|
135
|
+
}
|
|
136
|
+
// The webpack config files of Angular webpack targets that import Module
|
|
137
|
+
// Federation, following relative imports. An import or config the migration
|
|
138
|
+
// cannot read is recorded in `unresolved`.
|
|
139
|
+
function findModuleFederationConfigs(tree, scan, unresolved) {
|
|
140
|
+
const configs = new Set();
|
|
141
|
+
const visited = new Set();
|
|
142
|
+
const visit = (fromDir, specifier, importer) => {
|
|
143
|
+
if (MODULE_FEDERATION_SPECIFIER.test(specifier)) {
|
|
144
|
+
configs.add(importer);
|
|
145
|
+
return;
|
|
146
|
+
}
|
|
147
|
+
if (specifier.startsWith('.')) {
|
|
148
|
+
const filePath = resolveFile(tree, (0, devkit_1.joinPathFragments)(fromDir, specifier));
|
|
149
|
+
if (!filePath) {
|
|
150
|
+
unresolved.push(`${importer} loads "${specifier}", which is missing`);
|
|
151
|
+
return;
|
|
152
|
+
}
|
|
153
|
+
if (visited.has(filePath)) {
|
|
154
|
+
return;
|
|
155
|
+
}
|
|
156
|
+
visited.add(filePath);
|
|
157
|
+
const { specifiers, computed } = readModuleSpecifiers(filePath, tree.read(filePath, 'utf-8'));
|
|
158
|
+
if (computed) {
|
|
159
|
+
unresolved.push(`${filePath} has a computed require or import`);
|
|
160
|
+
}
|
|
161
|
+
for (const s of specifiers) {
|
|
162
|
+
visit((0, path_1.dirname)(filePath), s, filePath);
|
|
163
|
+
}
|
|
164
|
+
return;
|
|
165
|
+
}
|
|
166
|
+
if (!(0, internal_1.isBuiltinModuleImport)(specifier) &&
|
|
167
|
+
!isInstalledPackage(tree, fromDir, specifier, scan)) {
|
|
168
|
+
unresolved.push(`${importer} loads "${specifier}", which is not an installed package`);
|
|
169
|
+
}
|
|
170
|
+
};
|
|
171
|
+
const projectRoots = new Set();
|
|
172
|
+
const visitTarget = (executor, target, workspaceRoot, projectRoot, label) => {
|
|
173
|
+
if (!isAngularWebpackExecutor(executor)) {
|
|
174
|
+
return;
|
|
175
|
+
}
|
|
176
|
+
projectRoots.add(projectRoot);
|
|
177
|
+
for (const options of [
|
|
178
|
+
target.options,
|
|
179
|
+
...Object.values(target.configurations ?? {}),
|
|
180
|
+
]) {
|
|
181
|
+
for (const specifier of getWebpackConfigSpecifiers(executor, options ?? {}, projectRoot)) {
|
|
182
|
+
visit(workspaceRoot, specifier, label);
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
};
|
|
186
|
+
const targetDefaults = (0, devkit_1.readNxJson)(tree)?.targetDefaults;
|
|
187
|
+
for (const [projectName, project] of (0, devkit_1.getProjects)(tree)) {
|
|
188
|
+
for (const [targetName, target] of Object.entries(project.targets ?? {})) {
|
|
189
|
+
const defaults = (0, internal_1.readTargetDefaultsForTarget)(targetName, targetDefaults, target.executor, {
|
|
190
|
+
projectName,
|
|
191
|
+
projectNode: {
|
|
192
|
+
name: projectName,
|
|
193
|
+
type: project.projectType === 'application' ? 'app' : 'lib',
|
|
194
|
+
data: project,
|
|
195
|
+
},
|
|
196
|
+
});
|
|
197
|
+
const merged = defaults
|
|
198
|
+
? (0, internal_1.mergeTargetConfigurations)(target, defaults)
|
|
199
|
+
: target;
|
|
200
|
+
visitTarget(merged.executor, merged, '.', project.root, `${projectName}:${targetName}`);
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
for (const angularJsonPath of scan.angularJsonPaths) {
|
|
204
|
+
let angularJson;
|
|
205
|
+
try {
|
|
206
|
+
angularJson = (0, devkit_1.readJson)(tree, angularJsonPath);
|
|
207
|
+
}
|
|
208
|
+
catch {
|
|
209
|
+
unresolved.push(`${angularJsonPath} could not be parsed`);
|
|
210
|
+
continue;
|
|
211
|
+
}
|
|
212
|
+
const workspaceRoot = (0, path_1.dirname)(angularJsonPath);
|
|
213
|
+
for (const [projectName, project] of Object.entries(angularJson.projects ?? {})) {
|
|
214
|
+
const projectRoot = (0, devkit_1.joinPathFragments)(workspaceRoot, project.root ?? '');
|
|
215
|
+
for (const [targetName, target] of Object.entries(project.architect ?? project.targets ?? {})) {
|
|
216
|
+
visitTarget(target.builder, target, workspaceRoot, projectRoot, `${angularJsonPath} ${projectName}:${targetName}`);
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
// Configs a target does not reference directly, such as a remote's
|
|
221
|
+
// module-federation.config, are found by name.
|
|
222
|
+
for (const projectRoot of projectRoots) {
|
|
223
|
+
for (const child of tree.children(projectRoot)) {
|
|
224
|
+
if (WEBPACK_CONFIG_FILE.test(child)) {
|
|
225
|
+
visit(projectRoot, `./${child}`, projectRoot);
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
return [...configs];
|
|
230
|
+
}
|
|
231
|
+
function isAngularWebpackExecutor(executor) {
|
|
232
|
+
return (!!executor &&
|
|
233
|
+
(NX_WEBPACK_EXECUTORS.has(executor) ||
|
|
234
|
+
executor.startsWith('@angular-builders/custom-webpack:') ||
|
|
235
|
+
executor.startsWith('ngx-build-plus:')));
|
|
236
|
+
}
|
|
237
|
+
// The webpack config modules a target loads, as specifiers relative to the
|
|
238
|
+
// workspace root.
|
|
239
|
+
function getWebpackConfigSpecifiers(executor, options, projectRoot) {
|
|
240
|
+
const toSpecifier = (path) => `./${path
|
|
241
|
+
.replace(/^\{workspaceRoot\}\/?/, '')
|
|
242
|
+
.replace(/\{projectRoot\}/g, projectRoot)}`;
|
|
243
|
+
const { customWebpackConfig, extraWebpackConfig, plugin } = options;
|
|
244
|
+
const specifiers = [];
|
|
245
|
+
if (typeof customWebpackConfig?.path === 'string') {
|
|
246
|
+
specifiers.push(toSpecifier(customWebpackConfig.path));
|
|
247
|
+
}
|
|
248
|
+
else if (customWebpackConfig &&
|
|
249
|
+
executor.startsWith('@angular-builders/custom-webpack:')) {
|
|
250
|
+
specifiers.push('./webpack.config.js');
|
|
251
|
+
}
|
|
252
|
+
if (typeof extraWebpackConfig === 'string') {
|
|
253
|
+
specifiers.push(toSpecifier(extraWebpackConfig));
|
|
254
|
+
}
|
|
255
|
+
// ngx-build-plus loads a `~` plugin path from the workspace root and
|
|
256
|
+
// anything else as a module.
|
|
257
|
+
if (typeof plugin === 'string' && plugin) {
|
|
258
|
+
specifiers.push(plugin.startsWith('~') ? toSpecifier(plugin.slice(1)) : plugin);
|
|
259
|
+
}
|
|
260
|
+
return specifiers;
|
|
261
|
+
}
|
|
262
|
+
function resolveFile(tree, path) {
|
|
263
|
+
return [
|
|
264
|
+
path,
|
|
265
|
+
...RESOLVE_EXTENSIONS.map((extension) => `${path}${extension}`),
|
|
266
|
+
...RESOLVE_EXTENSIONS.map((extension) => (0, devkit_1.joinPathFragments)(path, `index${extension}`)),
|
|
267
|
+
].find((candidate) => tree.isFile(candidate));
|
|
268
|
+
}
|
|
269
|
+
// A package installed in a node_modules folder the importer resolves from, or
|
|
270
|
+
// declared by the importer's nearest package.json for Yarn PnP installs, which
|
|
271
|
+
// have no node_modules. A workspace package or path alias points back into the
|
|
272
|
+
// workspace, so it is not one.
|
|
273
|
+
function isInstalledPackage(tree, fromDir, specifier, scan) {
|
|
274
|
+
const segments = specifier.split('/');
|
|
275
|
+
const packageName = segments
|
|
276
|
+
.slice(0, specifier.startsWith('@') ? 2 : 1)
|
|
277
|
+
.join('/');
|
|
278
|
+
if (scan.workspacePackages.has(packageName)) {
|
|
279
|
+
return false;
|
|
280
|
+
}
|
|
281
|
+
let nearestPackageJsonChecked = false;
|
|
282
|
+
for (let dir = fromDir;; dir = (0, path_1.dirname)(dir)) {
|
|
283
|
+
if (tree.exists((0, devkit_1.joinPathFragments)(dir, 'node_modules', packageName, 'package.json'))) {
|
|
284
|
+
return true;
|
|
285
|
+
}
|
|
286
|
+
const declared = scan.declaredDependencies.get(dir);
|
|
287
|
+
if (declared && !nearestPackageJsonChecked) {
|
|
288
|
+
nearestPackageJsonChecked = true;
|
|
289
|
+
if (declared.has(packageName)) {
|
|
290
|
+
return true;
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
if (dir === '.') {
|
|
294
|
+
return false;
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
// Specifiers of `import`/`export ... from`, `import x = require()`,
|
|
299
|
+
// `import()` and `require()`. `computed` is set when an `import()` or
|
|
300
|
+
// `require()` takes a value other than a string literal.
|
|
301
|
+
function readModuleSpecifiers(filePath, content) {
|
|
302
|
+
ts ??= (0, internal_2.ensureTypescript)();
|
|
303
|
+
const sourceFile = ts.createSourceFile(filePath, content, ts.ScriptTarget.Latest, true);
|
|
304
|
+
const specifiers = [];
|
|
305
|
+
let computed = false;
|
|
306
|
+
const visit = (node) => {
|
|
307
|
+
if ((ts.isImportDeclaration(node) || ts.isExportDeclaration(node)) &&
|
|
308
|
+
node.moduleSpecifier &&
|
|
309
|
+
ts.isStringLiteral(node.moduleSpecifier)) {
|
|
310
|
+
specifiers.push(node.moduleSpecifier.text);
|
|
311
|
+
}
|
|
312
|
+
else if (ts.isExternalModuleReference(node) &&
|
|
313
|
+
ts.isStringLiteral(node.expression)) {
|
|
314
|
+
specifiers.push(node.expression.text);
|
|
315
|
+
}
|
|
316
|
+
else if (ts.isCallExpression(node) &&
|
|
317
|
+
(node.expression.kind === ts.SyntaxKind.ImportKeyword ||
|
|
318
|
+
(ts.isIdentifier(node.expression) &&
|
|
319
|
+
node.expression.text === 'require'))) {
|
|
320
|
+
const [argument] = node.arguments;
|
|
321
|
+
if (argument && ts.isStringLiteralLike(argument)) {
|
|
322
|
+
specifiers.push(argument.text);
|
|
323
|
+
}
|
|
324
|
+
else {
|
|
325
|
+
computed = true;
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
ts.forEachChild(node, visit);
|
|
329
|
+
};
|
|
330
|
+
visit(sourceFile);
|
|
331
|
+
return { specifiers, computed };
|
|
332
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
#### Upgrade Angular to 22.2
|
|
2
|
+
|
|
3
|
+
Updates the Angular packages of an Angular 22.1 workspace to 22.2, unless the workspace uses Cypress component testing or webpack Module Federation in an Angular project.
|
|
4
|
+
|
|
5
|
+
Angular 22.2 installs webpack 5.111 and webpack-dev-server 6 through `@angular-devkit/build-angular`. Cypress rejects that webpack-dev-server when it starts Angular component tests ([cypress-io/cypress#34259](https://github.com/cypress-io/cypress/issues/34259)). Module Federation builds fail on that webpack ([module-federation/core#5077](https://github.com/module-federation/core/issues/5077)). The migration keeps the workspace on Angular 22.1 and reports why when it finds either of these:
|
|
6
|
+
|
|
7
|
+
- An import from `cypress/angular`, `@cypress/angular` or one of their variants, or from `@nx/angular/plugins/component-testing`, in any file of the workspace.
|
|
8
|
+
- An import from `@module-federation/enhanced`, `@module-federation/node`, `@nx/module-federation`, `@nx/angular/mf` or `@nx/angular/module-federation` in the webpack config of an Angular project.
|
|
9
|
+
|
|
10
|
+
An Angular project is one with an `@nx/angular` webpack or Module Federation executor, an `@angular-builders/custom-webpack` builder or an `ngx-build-plus` builder. Targets are read from `project.json`, including executors inherited from `targetDefaults`, and from every `angular.json`. The migration reads the webpack configs these targets reference, the `webpack*` and `module-federation.config` files in the project root, and every file they import through a relative path. When a config imports something the migration cannot follow, such as a path alias or a workspace package, a Module Federation import anywhere in the workspace also keeps Angular 22.1.
|
|
11
|
+
|
|
12
|
+
Rspack builds, Native Federation and `@angular-architects/module-federation` don't hold the update. The last one uses the container plugin built into webpack, which works with webpack 5.111.
|
|
13
|
+
|
|
14
|
+
The migration updates only the packages that the root `package.json` declares, and a catalog reference is updated in the catalog. `@angular/core` is added to `dependencies` when the root doesn't declare it. A later Nx migration updates a workspace kept on Angular 22.1 once the upstream issues are fixed.
|
|
15
|
+
|
|
16
|
+
#### Examples
|
|
17
|
+
|
|
18
|
+
##### Before
|
|
19
|
+
|
|
20
|
+
```jsonc title="package.json"
|
|
21
|
+
{
|
|
22
|
+
"dependencies": {
|
|
23
|
+
"@angular/common": "~22.1.0",
|
|
24
|
+
"@angular/core": "~22.1.0",
|
|
25
|
+
},
|
|
26
|
+
"devDependencies": {
|
|
27
|
+
"@angular/cli": "~22.1.0",
|
|
28
|
+
"@angular-devkit/build-angular": "~22.1.0",
|
|
29
|
+
},
|
|
30
|
+
}
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
##### After
|
|
34
|
+
|
|
35
|
+
```jsonc title="package.json"
|
|
36
|
+
{
|
|
37
|
+
"dependencies": {
|
|
38
|
+
"@angular/common": "~22.2.0",
|
|
39
|
+
"@angular/core": "~22.2.0",
|
|
40
|
+
},
|
|
41
|
+
"devDependencies": {
|
|
42
|
+
"@angular/cli": "~22.2.0",
|
|
43
|
+
"@angular-devkit/build-angular": "~22.2.0",
|
|
44
|
+
},
|
|
45
|
+
}
|
|
46
|
+
```
|
|
@@ -138,8 +138,10 @@ async function buildAngularProjects(configFilePath, options, angularWorkspaceRoo
|
|
|
138
138
|
else if (knownExecutors.build.has(angularTarget.builder)) {
|
|
139
139
|
await updateBuildTarget(projectName, nxTargetName, targets[nxTargetName], angularTarget, context, angularWorkspaceRoot, project.root, namedInputs);
|
|
140
140
|
}
|
|
141
|
-
else if (knownExecutors.devServer.has(angularTarget.builder)
|
|
141
|
+
else if (knownExecutors.devServer.has(angularTarget.builder) ||
|
|
142
|
+
knownExecutors.serveSsr.has(angularTarget.builder)) {
|
|
142
143
|
targets[nxTargetName].continuous = true;
|
|
144
|
+
targets[nxTargetName].readyWhen = (0, internal_1.getReadyCheckReadyWhen)('@nx/angular/ready-check', (0, node_path_1.basename)(configFilePath));
|
|
143
145
|
targets[nxTargetName].metadata.help.example.options = { port: 4201 };
|
|
144
146
|
}
|
|
145
147
|
else if (knownExecutors.extractI18n.has(angularTarget.builder)) {
|
|
@@ -153,10 +155,6 @@ async function buildAngularProjects(configFilePath, options, angularWorkspaceRoo
|
|
|
153
155
|
else if (knownExecutors.server.has(angularTarget.builder)) {
|
|
154
156
|
updateServerTarget(targets[nxTargetName], angularTarget, context, angularWorkspaceRoot, project.root, namedInputs);
|
|
155
157
|
}
|
|
156
|
-
else if (knownExecutors.serveSsr.has(angularTarget.builder)) {
|
|
157
|
-
targets[nxTargetName].continuous = true;
|
|
158
|
-
targets[nxTargetName].metadata.help.example.options = { port: 4201 };
|
|
159
|
-
}
|
|
160
158
|
else if (knownExecutors.prerender.has(angularTarget.builder)) {
|
|
161
159
|
prerenderTargets.push({ target: nxTargetName, project: projectName });
|
|
162
160
|
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { type ServerAddress } from '@nx/devkit/internal';
|
|
2
|
+
import type { AngularProjectConfiguration } from '../plugin';
|
|
3
|
+
export interface AngularWorkspace {
|
|
4
|
+
projects?: Record<string, AngularProjectConfiguration>;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Where the dev server of the task's `ng serve` or `ng run` command listens,
|
|
8
|
+
* resolved the way the Angular CLI and the target's builder resolve it, or
|
|
9
|
+
* null when nothing can be probed.
|
|
10
|
+
*/
|
|
11
|
+
export declare function getDevServerAddress(options: Record<string, unknown>, workspace: AngularWorkspace, root: string): ServerAddress | null;
|
|
12
|
+
/**
|
|
13
|
+
* The readyWhen of the inferred dev server targets. Runs in the env and with
|
|
14
|
+
* the options of the task, resolves the target its `ng` command runs from the
|
|
15
|
+
* workspace config, and waits for the dev server's port.
|
|
16
|
+
*/
|
|
17
|
+
export declare function waitForAngularDevServer(workspaceConfigPath: string): Promise<void>;
|