@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
|
@@ -1,22 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getCustomWebpackConfig = getCustomWebpackConfig;
|
|
4
|
-
exports.convertWebpackConfigToUseNxModuleFederationPlugin = convertWebpackConfigToUseNxModuleFederationPlugin;
|
|
5
|
-
const devkit_1 = require("@nx/devkit");
|
|
6
4
|
const internal_1 = require("@nx/devkit/internal");
|
|
7
5
|
const path_1 = require("path");
|
|
8
|
-
const tsquery_1 = require("@phenomnomnominal/tsquery");
|
|
9
6
|
const FILE_EXTENSION_REGEX = /\.[^.]+$/;
|
|
10
7
|
async function getCustomWebpackConfig(tree, projectRoot, pathToCustomWebpackConfig) {
|
|
11
|
-
const webpackConfigContents = tree.read(pathToCustomWebpackConfig, 'utf-8');
|
|
12
|
-
if (webpackConfigContents.includes('@nx/module-federation/angular') &&
|
|
13
|
-
webpackConfigContents.includes('withModuleFederation')) {
|
|
14
|
-
tree.write(pathToCustomWebpackConfig, convertWebpackConfigToUseNxModuleFederationPlugin(webpackConfigContents));
|
|
15
|
-
return {
|
|
16
|
-
isWebpackConfigFunction: false,
|
|
17
|
-
normalizedPathToCustomWebpackConfig: `./${(0, path_1.relative)(projectRoot, pathToCustomWebpackConfig).replace(FILE_EXTENSION_REGEX, '')}`,
|
|
18
|
-
};
|
|
19
|
-
}
|
|
20
8
|
const configFile = await (0, internal_1.loadConfigFile)((0, path_1.join)(tree.root, pathToCustomWebpackConfig));
|
|
21
9
|
const webpackConfig = 'default' in configFile ? configFile.default : configFile;
|
|
22
10
|
return {
|
|
@@ -24,54 +12,3 @@ async function getCustomWebpackConfig(tree, projectRoot, pathToCustomWebpackConf
|
|
|
24
12
|
normalizedPathToCustomWebpackConfig: `./${(0, path_1.relative)(projectRoot, pathToCustomWebpackConfig).replace(FILE_EXTENSION_REGEX, '')}`,
|
|
25
13
|
};
|
|
26
14
|
}
|
|
27
|
-
function convertWebpackConfigToUseNxModuleFederationPlugin(webpackConfigContents) {
|
|
28
|
-
let newWebpackConfigContents = webpackConfigContents;
|
|
29
|
-
let sourceFile = (0, tsquery_1.ast)(webpackConfigContents);
|
|
30
|
-
const withModuleFederationImportNodes = (0, tsquery_1.query)(sourceFile, 'ImportDeclaration:has(StringLiteral[value=@nx/module-federation/angular])');
|
|
31
|
-
if (withModuleFederationImportNodes.length > 0) {
|
|
32
|
-
const withModuleFederationImportNode = withModuleFederationImportNodes[0];
|
|
33
|
-
newWebpackConfigContents = `${webpackConfigContents.slice(0, withModuleFederationImportNode.getStart())}import { NxModuleFederationPlugin, NxModuleFederationDevServerPlugin } from '@nx/module-federation/angular';${webpackConfigContents.slice(withModuleFederationImportNode.getEnd())}`;
|
|
34
|
-
sourceFile = (0, tsquery_1.ast)(newWebpackConfigContents);
|
|
35
|
-
const exportedWithModuleFederationNodes = (0, tsquery_1.query)(sourceFile, 'ExportAssignment:has(CallExpression > Identifier[name=withModuleFederation])');
|
|
36
|
-
if (exportedWithModuleFederationNodes.length > 0) {
|
|
37
|
-
const exportedWithModuleFederationNode = exportedWithModuleFederationNodes[0];
|
|
38
|
-
newWebpackConfigContents = `${newWebpackConfigContents.slice(0, exportedWithModuleFederationNode.getStart())}${newWebpackConfigContents.slice(exportedWithModuleFederationNode.getEnd())}
|
|
39
|
-
export default {
|
|
40
|
-
plugins: [
|
|
41
|
-
new NxModuleFederationPlugin({ config }, {
|
|
42
|
-
dts: false,
|
|
43
|
-
}),
|
|
44
|
-
new NxModuleFederationDevServerPlugin({ config }),
|
|
45
|
-
]
|
|
46
|
-
}
|
|
47
|
-
`;
|
|
48
|
-
}
|
|
49
|
-
else {
|
|
50
|
-
devkit_1.logger.warn("Could not find 'export default withModuleFederation' in the webpack config file. Skipping conversion.");
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
const withModuleFederationRequireNodes = (0, tsquery_1.query)(sourceFile, 'VariableStatement:has(CallExpression > Identifier[name=withModuleFederation], StringLiteral[value=@nx/module-federation/angular])');
|
|
54
|
-
if (withModuleFederationRequireNodes.length > 0) {
|
|
55
|
-
const withModuleFederationRequireNode = withModuleFederationRequireNodes[0];
|
|
56
|
-
newWebpackConfigContents = `${webpackConfigContents.slice(0, withModuleFederationRequireNode.getStart())}const { NxModuleFederationPlugin, NxModuleFederationDevServerPlugin } = require('@nx/module-federation/rspack');${webpackConfigContents.slice(withModuleFederationRequireNode.getEnd())}`;
|
|
57
|
-
sourceFile = (0, tsquery_1.ast)(newWebpackConfigContents);
|
|
58
|
-
const exportedWithModuleFederationNodes = (0, tsquery_1.query)(sourceFile, 'ExpressionStatement:has(BinaryExpression > PropertyAccessExpression:has(Identifier[name=module], Identifier[name=exports]), CallExpression:has(Identifier[name=withModuleFederation]))');
|
|
59
|
-
if (exportedWithModuleFederationNodes.length > 0) {
|
|
60
|
-
const exportedWithModuleFederationNode = exportedWithModuleFederationNodes[0];
|
|
61
|
-
newWebpackConfigContents = `${newWebpackConfigContents.slice(0, exportedWithModuleFederationNode.getStart())}${newWebpackConfigContents.slice(exportedWithModuleFederationNode.getEnd())}
|
|
62
|
-
module.exports = {
|
|
63
|
-
plugins: [
|
|
64
|
-
new NxModuleFederationPlugin({ config }, {
|
|
65
|
-
dts: false,
|
|
66
|
-
}),
|
|
67
|
-
new NxModuleFederationDevServerPlugin({ config }),
|
|
68
|
-
]
|
|
69
|
-
}
|
|
70
|
-
`;
|
|
71
|
-
}
|
|
72
|
-
else {
|
|
73
|
-
devkit_1.logger.warn("Could not find 'module.exports = withModuleFederation' in the webpack config file. Skipping conversion.");
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
return newWebpackConfigContents;
|
|
77
|
-
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.validateNoModuleFederation = validateNoModuleFederation;
|
|
4
|
+
const MODULE_FEDERATION_EXECUTORS = [
|
|
5
|
+
'@nx/angular:module-federation-dev-server',
|
|
6
|
+
'@nx/angular:module-federation-dev-ssr',
|
|
7
|
+
];
|
|
8
|
+
function validateNoModuleFederation(tree, project) {
|
|
9
|
+
if (usesModuleFederation(tree, project)) {
|
|
10
|
+
throw new Error(`The project ${project.name} is using Module Federation. At the moment, we don't support migrating projects that use Module Federation. See https://nx.dev/docs/kb/migrate-angular-module-federation.`);
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
function usesModuleFederation(tree, project) {
|
|
14
|
+
for (const target of Object.values(project.targets ?? {})) {
|
|
15
|
+
if (MODULE_FEDERATION_EXECUTORS.includes(target.executor)) {
|
|
16
|
+
return true;
|
|
17
|
+
}
|
|
18
|
+
const allOptions = [
|
|
19
|
+
target.options,
|
|
20
|
+
...Object.values(target.configurations ?? {}),
|
|
21
|
+
];
|
|
22
|
+
for (const options of allOptions) {
|
|
23
|
+
const configPath = options?.customWebpackConfig?.path;
|
|
24
|
+
if (configPath &&
|
|
25
|
+
tree.exists(configPath) &&
|
|
26
|
+
tree.read(configPath, 'utf-8').includes('@nx/module-federation')) {
|
|
27
|
+
return true;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
return false;
|
|
32
|
+
}
|
package/dist/src/generators/cypress-component-configuration/cypress-component-configuration.js
CHANGED
|
@@ -64,8 +64,6 @@ async function cypressComponentConfiguration(tree, options) {
|
|
|
64
64
|
tasks.push(await baseCyCTConfig(tree, {
|
|
65
65
|
project: options.project,
|
|
66
66
|
skipFormat: true,
|
|
67
|
-
addPlugin: false,
|
|
68
|
-
addExplicitTargets: true,
|
|
69
67
|
skipPackageJson: options.skipPackageJson,
|
|
70
68
|
}));
|
|
71
69
|
await configureCypressCT(tree, options);
|
|
@@ -142,20 +140,10 @@ async function configureCypressCT(tree, options) {
|
|
|
142
140
|
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>]).');
|
|
143
141
|
}
|
|
144
142
|
}
|
|
145
|
-
const ctConfigOptions = {
|
|
143
|
+
const ctConfigOptions = {
|
|
144
|
+
buildTarget: found.target,
|
|
145
|
+
};
|
|
146
146
|
const projectConfig = (0, devkit_1.readProjectConfiguration)(tree, options.project);
|
|
147
|
-
if (projectConfig.targets?.['component-test']?.executor ===
|
|
148
|
-
'@nx/cypress:cypress') {
|
|
149
|
-
projectConfig.targets['component-test'].options = {
|
|
150
|
-
...projectConfig.targets['component-test'].options,
|
|
151
|
-
skipServe: true,
|
|
152
|
-
devServerTarget: found.target,
|
|
153
|
-
};
|
|
154
|
-
(0, devkit_1.updateProjectConfiguration)(tree, options.project, projectConfig);
|
|
155
|
-
}
|
|
156
|
-
else {
|
|
157
|
-
ctConfigOptions.buildTarget = found.target;
|
|
158
|
-
}
|
|
159
147
|
const { addDefaultCTConfig, getProjectCypressConfigPath, getInstalledCypressMajorVersion, } = require('@nx/cypress/internal');
|
|
160
148
|
const cypressConfigPath = getProjectCypressConfigPath(tree, projectConfig.root);
|
|
161
149
|
const updatedCyConfig = await addDefaultCTConfig(tree.read(cypressConfigPath, 'utf-8'), ctConfigOptions, '@nx/angular/plugins/component-testing', getInstalledCypressMajorVersion(tree));
|
|
@@ -16,8 +16,7 @@ async function angularInitGenerator(tree, options) {
|
|
|
16
16
|
// generators do not use `angular.json`, and `nx init` should split
|
|
17
17
|
// `angular.json` into multiple `project.json` files -- as this is preferred
|
|
18
18
|
// by most folks we've talked to.
|
|
19
|
-
|
|
20
|
-
if (options.addPlugin) {
|
|
19
|
+
if (process.env.NX_RUNNING_NX_IMPORT === 'true') {
|
|
21
20
|
await (0, internal_1.addPlugin)(tree, await (0, devkit_1.createProjectGraphAsync)(), '@nx/angular/plugin', plugin_1.createNodes, {
|
|
22
21
|
targetNamePrefix: ['', 'angular:', 'angular-'],
|
|
23
22
|
}, options.updatePackageScripts);
|
|
@@ -19,10 +19,6 @@ export interface NormalizedSchema {
|
|
|
19
19
|
strict?: boolean;
|
|
20
20
|
compilationMode?: 'full' | 'partial';
|
|
21
21
|
enableTypedLinting?: boolean;
|
|
22
|
-
/**
|
|
23
|
-
* @deprecated Use `enableTypedLinting` instead. This option will be removed in Nx v24.
|
|
24
|
-
*/
|
|
25
|
-
setParserOptionsProject?: boolean;
|
|
26
22
|
skipModule?: boolean;
|
|
27
23
|
skipPackageJson?: boolean;
|
|
28
24
|
skipPostInstall?: boolean;
|
|
@@ -3,10 +3,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.libraryGenerator = libraryGenerator;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const internal_1 = require("@nx/devkit/internal");
|
|
6
|
-
const internal_2 = require("@nx/eslint/internal");
|
|
7
6
|
const devkit_1 = require("@nx/devkit");
|
|
8
7
|
const js_1 = require("@nx/js");
|
|
9
|
-
const
|
|
8
|
+
const internal_2 = require("@nx/js/internal");
|
|
10
9
|
const init_1 = tslib_1.__importDefault(require("../../generators/init/init"));
|
|
11
10
|
const assert_supported_angular_version_1 = require("../../utils/assert-supported-angular-version");
|
|
12
11
|
const test_runners_1 = require("../../utils/test-runners");
|
|
@@ -74,7 +73,7 @@ async function libraryGenerator(tree, schema) {
|
|
|
74
73
|
() => (0, devkit_1.installPackagesTask)(tree),
|
|
75
74
|
];
|
|
76
75
|
if (libraryOptions.publishable) {
|
|
77
|
-
tasks.push(await (0,
|
|
76
|
+
tasks.push(await (0, internal_2.releaseTasks)(tree));
|
|
78
77
|
}
|
|
79
78
|
tasks.push(() => (0, internal_1.logShowProjectCommand)(libraryOptions.name));
|
|
80
79
|
return (0, devkit_1.runTasksInSerial)(...tasks);
|
|
@@ -127,7 +126,7 @@ async function addLinting(host, options) {
|
|
|
127
126
|
projectRoot: options.projectRoot,
|
|
128
127
|
prefix: options.prefix,
|
|
129
128
|
unitTestRunner: options.unitTestRunner,
|
|
130
|
-
enableTypedLinting:
|
|
129
|
+
enableTypedLinting: options.enableTypedLinting,
|
|
131
130
|
skipFormat: true,
|
|
132
131
|
skipPackageJson: options.skipPackageJson,
|
|
133
132
|
});
|
|
@@ -23,10 +23,6 @@ export interface Schema {
|
|
|
23
23
|
unitTestRunner?: UnitTestRunner;
|
|
24
24
|
compilationMode?: 'full' | 'partial';
|
|
25
25
|
enableTypedLinting?: boolean;
|
|
26
|
-
/**
|
|
27
|
-
* @deprecated Use `enableTypedLinting` instead. This option will be removed in Nx v24.
|
|
28
|
-
*/
|
|
29
|
-
setParserOptionsProject?: boolean;
|
|
30
26
|
skipModule?: boolean;
|
|
31
27
|
skipPackageJson?: boolean;
|
|
32
28
|
standalone?: boolean;
|
|
@@ -39,6 +35,5 @@ export interface Schema {
|
|
|
39
35
|
skipTests?: boolean;
|
|
40
36
|
selector?: string;
|
|
41
37
|
skipSelector?: boolean;
|
|
42
|
-
addPlugin?: boolean;
|
|
43
38
|
skipTsConfig?: boolean;
|
|
44
39
|
}
|
|
@@ -111,12 +111,6 @@
|
|
|
111
111
|
"description": "Whether to enable typed linting. For flat configs, this configures the recommended `parserOptions.projectService` and `tsconfigRootDir`. For legacy `.eslintrc` configs, this configures `parserOptions.project`. We do not enable this by default for lint performance reasons.",
|
|
112
112
|
"default": false
|
|
113
113
|
},
|
|
114
|
-
"setParserOptionsProject": {
|
|
115
|
-
"type": "boolean",
|
|
116
|
-
"description": "Deprecated alias for `enableTypedLinting`.",
|
|
117
|
-
"default": false,
|
|
118
|
-
"x-deprecated": "Use `enableTypedLinting` instead. This option will be removed in Nx v24."
|
|
119
|
-
},
|
|
120
114
|
"skipModule": {
|
|
121
115
|
"type": "boolean",
|
|
122
116
|
"description": "Whether to skip the creation of a default module when generating the library.",
|
|
@@ -33,7 +33,6 @@ class AngularEslintLintMigrator extends builder_migrator_1.BuilderMigrator {
|
|
|
33
33
|
}
|
|
34
34
|
}
|
|
35
35
|
async updateTargetConfiguration(targetName, target) {
|
|
36
|
-
target.executor = '@nx/eslint:lint';
|
|
37
36
|
if (!target.options) {
|
|
38
37
|
this.logger.warn(`The target "${targetName}" is not specifying any options. Skipping updating the target configuration.`);
|
|
39
38
|
return;
|
|
@@ -60,6 +59,18 @@ class AngularEslintLintMigrator extends builder_migrator_1.BuilderMigrator {
|
|
|
60
59
|
this.logger.warn(`The lint file pattern "${pattern}" specified in the "${targetName}" target is not contained in the project root or source root. The pattern will not be updated.`);
|
|
61
60
|
return pattern;
|
|
62
61
|
});
|
|
62
|
+
// `@nx/eslint:lint` is gone in v24, so the migrated target runs the ESLint
|
|
63
|
+
// CLI directly. Patterns were rebased onto the new project root above.
|
|
64
|
+
const eslintConfig = target.options.eslintConfig && this.newEsLintConfigPath;
|
|
65
|
+
const patterns = target.options.lintFilePatterns ?? [];
|
|
66
|
+
delete target.executor;
|
|
67
|
+
delete target.options;
|
|
68
|
+
target.command = [
|
|
69
|
+
'eslint',
|
|
70
|
+
...(eslintConfig ? ['--config', eslintConfig] : []),
|
|
71
|
+
// Quoted so ESLint, not the shell, expands the globs: sh has no globstar.
|
|
72
|
+
...patterns.map((pattern) => `"${pattern}"`),
|
|
73
|
+
].join(' ');
|
|
63
74
|
(0, devkit_1.updateProjectConfiguration)(this.tree, this.project.name, {
|
|
64
75
|
...this.projectConfig,
|
|
65
76
|
});
|
|
@@ -19,6 +19,7 @@ export declare class AppMigrator extends ProjectMigrator<SupportedTargets> {
|
|
|
19
19
|
private updatePrerenderTargetConfiguration;
|
|
20
20
|
private updateServerTargetConfiguration;
|
|
21
21
|
private updateServeSsrTargetConfiguration;
|
|
22
|
+
private updateDevServerTargets;
|
|
22
23
|
private updateTsConfigFileUsedByBuildTarget;
|
|
23
24
|
private updateTsConfigFileUsedByServerTarget;
|
|
24
25
|
}
|
|
@@ -50,6 +50,11 @@ const supportedTargets = {
|
|
|
50
50
|
],
|
|
51
51
|
},
|
|
52
52
|
};
|
|
53
|
+
const readySignalingServeBuilders = new Set([
|
|
54
|
+
'@angular/build:dev-server',
|
|
55
|
+
'@angular-devkit/build-angular:dev-server',
|
|
56
|
+
'@angular-devkit/build-angular:ssr-dev-server',
|
|
57
|
+
]);
|
|
53
58
|
// TODO(leo): this will replace `supportedTargets` once the full refactor is done.
|
|
54
59
|
const supportedBuilderMigrators = [
|
|
55
60
|
builders_1.AngularBuildUnitTestMigrator,
|
|
@@ -139,6 +144,7 @@ class AppMigrator extends project_migrator_1.ProjectMigrator {
|
|
|
139
144
|
this.updateServerTargetConfiguration();
|
|
140
145
|
this.updatePrerenderTargetConfiguration();
|
|
141
146
|
this.updateServeSsrTargetConfiguration();
|
|
147
|
+
this.updateDevServerTargets();
|
|
142
148
|
(0, devkit_1.updateProjectConfiguration)(this.tree, this.project.name, {
|
|
143
149
|
...this.projectConfig,
|
|
144
150
|
});
|
|
@@ -342,6 +348,22 @@ class AppMigrator extends project_migrator_1.ProjectMigrator {
|
|
|
342
348
|
}
|
|
343
349
|
});
|
|
344
350
|
}
|
|
351
|
+
updateDevServerTargets() {
|
|
352
|
+
for (const targetType of ['serve', 'serveSsr']) {
|
|
353
|
+
const targetName = this.targetNames[targetType];
|
|
354
|
+
if (!targetName || this.shouldSkipTargetTypeMigration(targetType)) {
|
|
355
|
+
continue;
|
|
356
|
+
}
|
|
357
|
+
const target = this.projectConfig.targets[targetName];
|
|
358
|
+
if (!readySignalingServeBuilders.has(target.executor)) {
|
|
359
|
+
continue;
|
|
360
|
+
}
|
|
361
|
+
target.continuous ??= true;
|
|
362
|
+
if (target.readyWhen === undefined) {
|
|
363
|
+
target.readyWhen = { signal: true };
|
|
364
|
+
}
|
|
365
|
+
}
|
|
366
|
+
}
|
|
345
367
|
updateTsConfigFileUsedByBuildTarget(rootTsConfigFile, projectOffsetFromRoot) {
|
|
346
368
|
if (!this.targetNames.build ||
|
|
347
369
|
this.shouldSkipTargetTypeMigration('build')) {
|
|
@@ -223,9 +223,6 @@ class E2eMigrator extends project_migrator_1.ProjectMigrator {
|
|
|
223
223
|
tags: [],
|
|
224
224
|
implicitDependencies: [this.appName],
|
|
225
225
|
});
|
|
226
|
-
const nxJson = (0, devkit_1.readNxJson)(this.tree) ?? {};
|
|
227
|
-
const addPlugin = process.env.NX_ADD_PLUGINS !== 'false' &&
|
|
228
|
-
nxJson.useInferencePlugins !== false;
|
|
229
226
|
const { configurationGenerator } = (require('@nx/cypress'));
|
|
230
227
|
await configurationGenerator(this.tree, {
|
|
231
228
|
project: this.project.name,
|
|
@@ -234,7 +231,6 @@ class E2eMigrator extends project_migrator_1.ProjectMigrator {
|
|
|
234
231
|
// any target would do, we replace it later with the target existing in the project being migrated
|
|
235
232
|
devServerTarget: `${this.appName}:serve`,
|
|
236
233
|
baseUrl: 'http://localhost:4200',
|
|
237
|
-
addPlugin,
|
|
238
234
|
});
|
|
239
235
|
const cypressConfigFilePath = this.updateOrCreateCypressConfigFile(oldCypressConfigFilePath);
|
|
240
236
|
this.updateCypressProjectConfiguration(cypressConfigFilePath);
|
|
@@ -284,21 +280,21 @@ class E2eMigrator extends project_migrator_1.ProjectMigrator {
|
|
|
284
280
|
});
|
|
285
281
|
}
|
|
286
282
|
updateE2eCypressTarget(existingTarget, cypressConfig) {
|
|
283
|
+
// `@nx/cypress:cypress` is gone in v24, so the migrated target runs the
|
|
284
|
+
// Cypress CLI directly against the rebased config. `watch` selected the
|
|
285
|
+
// interactive runner, which is `cypress open`.
|
|
286
|
+
const isInteractive = existingTarget.options?.watch === true;
|
|
287
|
+
if (existingTarget.options?.devServerTarget) {
|
|
288
|
+
this.logger.warn(`The "devServerTarget" option is not supported by the Cypress CLI. Start "${existingTarget.options.devServerTarget}" separately, or set "baseUrl" in "${cypressConfig}".`);
|
|
289
|
+
}
|
|
287
290
|
const updatedTarget = {
|
|
288
291
|
...existingTarget,
|
|
289
|
-
|
|
290
|
-
options: {
|
|
291
|
-
...existingTarget.options,
|
|
292
|
-
cypressConfig,
|
|
293
|
-
},
|
|
292
|
+
command: `cypress ${isInteractive ? 'open' : 'run'} --e2e --config-file ${(0, path_1.basename)(cypressConfig)}`,
|
|
293
|
+
options: { cwd: (0, path_1.dirname)(cypressConfig) },
|
|
294
294
|
};
|
|
295
|
-
delete updatedTarget.
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
}
|
|
299
|
-
else {
|
|
300
|
-
delete updatedTarget.options.tsConfig;
|
|
301
|
-
}
|
|
295
|
+
delete updatedTarget.executor;
|
|
296
|
+
delete updatedTarget.configurations;
|
|
297
|
+
delete updatedTarget.defaultConfiguration;
|
|
302
298
|
return updatedTarget;
|
|
303
299
|
}
|
|
304
300
|
cypressConfigGlobToNewGlob(globPattern) {
|
|
@@ -156,9 +156,7 @@ function updatePackageJson(tree) {
|
|
|
156
156
|
});
|
|
157
157
|
}
|
|
158
158
|
async function updateRootEsLintConfig(tree, existingEsLintConfig, unitTestRunner) {
|
|
159
|
-
await (0, eslint_1.lintInitGenerator)(tree, {
|
|
160
|
-
addPlugin: false,
|
|
161
|
-
});
|
|
159
|
+
await (0, eslint_1.lintInitGenerator)(tree, {});
|
|
162
160
|
if (!existingEsLintConfig) {
|
|
163
161
|
// There was no eslint config in the root, so we set it up and use it as-is
|
|
164
162
|
(0, internal_1.setupRootEsLint)(tree, { unitTestRunner });
|
package/dist/src/generators/setup-ssr/files/v20+/application-builder/server/__serverFileName__
CHANGED
|
@@ -55,8 +55,22 @@ app.use('/**', (req, res, next) => {
|
|
|
55
55
|
*/
|
|
56
56
|
if (isMainModule(import.meta.url) || process.env['pm_id']) {
|
|
57
57
|
const port = process.env['PORT'] || <%= serverPort %>;
|
|
58
|
-
app.listen(port, () => {
|
|
58
|
+
const server = app.listen(port, async (error?: Error) => {
|
|
59
|
+
if (error) {
|
|
60
|
+
throw error;
|
|
61
|
+
}
|
|
62
|
+
|
|
59
63
|
console.log(`Node Express server listening on http://localhost:${port}`);
|
|
64
|
+
// Set when Nx waits for this server to be ready
|
|
65
|
+
if (process.env['NX_READY_SIGNAL_SOCKET']) {
|
|
66
|
+
try {
|
|
67
|
+
// Function keeps TypeScript and bundlers from rewriting or bundling the import
|
|
68
|
+
const load = new Function('s', 'return import(s)') as (s: string) => Promise<{ emitReadySignal(server: unknown): boolean }>;
|
|
69
|
+
(await load('@nx/js/ready-signal')).emitReadySignal(server);
|
|
70
|
+
} catch {
|
|
71
|
+
// @nx/js isn't installed
|
|
72
|
+
}
|
|
73
|
+
}
|
|
60
74
|
});
|
|
61
75
|
}
|
|
62
76
|
|
|
@@ -20,6 +20,10 @@ function addDependencies(tree, options) {
|
|
|
20
20
|
// so ask for one that does rather than for whichever the range resolves to
|
|
21
21
|
dependencies['@angular/ssr'] =
|
|
22
22
|
(0, version_utils_1.withSsrAllowedHostsSupport)(angularDevkitVersion);
|
|
23
|
+
if (options.isUsingApplicationBuilder || options.isRspack) {
|
|
24
|
+
// The server template imports @nx/js/ready-signal, which must resolve from the workspace root
|
|
25
|
+
devDependencies['@nx/js'] = versions_1.nxVersion;
|
|
26
|
+
}
|
|
23
27
|
if (options.isUsingApplicationBuilder) {
|
|
24
28
|
dependencies['@angular-devkit/build-angular'] = angularDevkitVersion;
|
|
25
29
|
}
|
|
@@ -75,6 +75,7 @@ function updateProjectConfigForBrowserBuilder(tree, options) {
|
|
|
75
75
|
};
|
|
76
76
|
projectConfig.targets['serve-ssr'] = {
|
|
77
77
|
continuous: true,
|
|
78
|
+
readyWhen: { signal: true },
|
|
78
79
|
executor: '@angular-devkit/build-angular:ssr-dev-server',
|
|
79
80
|
configurations: {
|
|
80
81
|
development: {
|
|
@@ -28,8 +28,6 @@ async function addJest(tree, options) {
|
|
|
28
28
|
skipSerializers: false,
|
|
29
29
|
skipPackageJson: options.skipPackageJson,
|
|
30
30
|
skipFormat: true,
|
|
31
|
-
addPlugin: options.addPlugin ?? false,
|
|
32
|
-
addExplicitTargets: !options.addPlugin,
|
|
33
31
|
});
|
|
34
32
|
const setupFile = (0, devkit_1.joinPathFragments)(options.projectRoot, 'src', 'test-setup.ts');
|
|
35
33
|
if (options.zoneless) {
|
|
@@ -12,7 +12,6 @@ export type AddVitestAnalogOptions = {
|
|
|
12
12
|
skipPackageJson: boolean;
|
|
13
13
|
strict: boolean;
|
|
14
14
|
zoneless: boolean;
|
|
15
|
-
addPlugin?: boolean;
|
|
16
15
|
};
|
|
17
16
|
export declare function addVitestAngular(tree: Tree, options: AddVitestAngularOptions): Promise<GeneratorCallback>;
|
|
18
17
|
export declare function addVitestAnalog(tree: Tree, options: AddVitestAnalogOptions): Promise<GeneratorCallback>;
|
|
@@ -81,7 +81,6 @@ async function addVitestAnalog(tree, options) {
|
|
|
81
81
|
uiFramework: 'angular',
|
|
82
82
|
testEnvironment: 'jsdom',
|
|
83
83
|
coverageProvider: 'v8',
|
|
84
|
-
addPlugin: options.addPlugin ?? false,
|
|
85
84
|
skipFormat: options.skipFormat,
|
|
86
85
|
skipPackageJson: options.skipPackageJson,
|
|
87
86
|
zoneless: options.zoneless,
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import type { Tree } from '@nx/devkit';
|
|
2
2
|
import type { Schema as ApplicationOptions } from '../application/schema';
|
|
3
|
-
import type { Schema as HostOptions } from '../host/schema';
|
|
4
3
|
import type { Schema as LibraryOptions } from '../library/schema';
|
|
5
|
-
import type { Schema as RemoteOptions } from '../remote/schema';
|
|
6
4
|
export declare function generateTestApplication(tree: Tree, options: ApplicationOptions): Promise<void>;
|
|
7
|
-
export declare function generateTestHostApplication(tree: Tree, options: HostOptions): Promise<void>;
|
|
8
|
-
export declare function generateTestRemoteApplication(tree: Tree, options: RemoteOptions): Promise<void>;
|
|
9
5
|
export declare function generateTestLibrary(tree: Tree, options: LibraryOptions): Promise<void>;
|
|
10
6
|
export declare function createStorybookTestWorkspaceForLib(libName: string): Promise<Tree>;
|
|
7
|
+
export declare function generateTestInlineScam(tree: Tree, options: {
|
|
8
|
+
name: string;
|
|
9
|
+
path: string;
|
|
10
|
+
}): Promise<void>;
|
|
@@ -1,33 +1,22 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.generateTestApplication = generateTestApplication;
|
|
4
|
-
exports.generateTestHostApplication = generateTestHostApplication;
|
|
5
|
-
exports.generateTestRemoteApplication = generateTestRemoteApplication;
|
|
6
4
|
exports.generateTestLibrary = generateTestLibrary;
|
|
7
5
|
exports.createStorybookTestWorkspaceForLib = createStorybookTestWorkspaceForLib;
|
|
6
|
+
exports.generateTestInlineScam = generateTestInlineScam;
|
|
8
7
|
const devkit_1 = require("@nx/devkit");
|
|
9
8
|
const testing_1 = require("@nx/devkit/testing");
|
|
10
9
|
const internal_1 = require("@nx/js/internal");
|
|
11
10
|
const test_runners_1 = require("../../utils/test-runners");
|
|
12
11
|
const application_1 = require("../application/application");
|
|
13
12
|
const component_1 = require("../component/component");
|
|
14
|
-
const host_1 = require("../host/host");
|
|
15
13
|
const library_1 = require("../library/library");
|
|
16
|
-
const remote_1 = require("../remote/remote");
|
|
17
14
|
async function generateTestApplication(tree, options) {
|
|
18
15
|
tree.write('.gitignore', '');
|
|
19
16
|
await (0, application_1.applicationGenerator)(tree, {
|
|
20
17
|
...options,
|
|
21
18
|
});
|
|
22
19
|
}
|
|
23
|
-
async function generateTestHostApplication(tree, options) {
|
|
24
|
-
tree.write('.gitignore', '');
|
|
25
|
-
await (0, host_1.host)(tree, { ...options });
|
|
26
|
-
}
|
|
27
|
-
async function generateTestRemoteApplication(tree, options) {
|
|
28
|
-
tree.write('.gitignore', '');
|
|
29
|
-
await (0, remote_1.remote)(tree, { ...options });
|
|
30
|
-
}
|
|
31
20
|
async function generateTestLibrary(tree, options) {
|
|
32
21
|
tree.write('.gitignore', '');
|
|
33
22
|
await (0, library_1.libraryGenerator)(tree, {
|
|
@@ -223,6 +212,24 @@ export class StaticMemberDeclarationsModule {
|
|
|
223
212
|
});
|
|
224
213
|
return tree;
|
|
225
214
|
}
|
|
215
|
+
async function generateTestInlineScam(tree, options) {
|
|
216
|
+
await (0, component_1.componentGenerator)(tree, {
|
|
217
|
+
...options,
|
|
218
|
+
standalone: false,
|
|
219
|
+
skipImport: true,
|
|
220
|
+
skipFormat: true,
|
|
221
|
+
});
|
|
222
|
+
const { className } = (0, devkit_1.names)(options.name);
|
|
223
|
+
const componentFilePath = `${options.path}.ts`;
|
|
224
|
+
tree.write(componentFilePath, `import { NgModule } from '@angular/core';
|
|
225
|
+
${tree.read(componentFilePath, 'utf-8')}
|
|
226
|
+
@NgModule({
|
|
227
|
+
declarations: [${className}],
|
|
228
|
+
exports: [${className}],
|
|
229
|
+
})
|
|
230
|
+
export class ${className}Module {}
|
|
231
|
+
`);
|
|
232
|
+
}
|
|
226
233
|
function generateModule(tree, options) {
|
|
227
234
|
const project = (0, devkit_1.readProjectConfiguration)(tree, options.project);
|
|
228
235
|
if (options.path === undefined) {
|
|
@@ -2,8 +2,9 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.default = default_1;
|
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
|
5
|
+
const internal_1 = require("@nx/devkit/internal");
|
|
5
6
|
const acknowledge_build_scripts_1 = require("../../generators/utils/acknowledge-build-scripts");
|
|
6
|
-
const
|
|
7
|
+
const version_utils_1 = require("../../generators/utils/version-utils");
|
|
7
8
|
// The `@nx/angular:application` and `@nx/angular:unit-test` executors import
|
|
8
9
|
// `@angular/build` directly to run the Angular builders, and any
|
|
9
10
|
// `@angular/build:*` executor is provided by that package; it is a required
|
|
@@ -12,7 +13,8 @@ const versions_1 = require("../../utils/versions");
|
|
|
12
13
|
// `@angular-devkit/build-angular`, which isn't reliable (it can be absent from
|
|
13
14
|
// node_modules, e.g. under Yarn Berry), so `require.resolve('@angular/build')`
|
|
14
15
|
// fails and the build breaks. Add it as a direct dependency when an executor
|
|
15
|
-
// needs it
|
|
16
|
+
// needs it. Match the version `@angular-devkit/build-angular` pins it to,
|
|
17
|
+
// because a newer `@angular/build` breaks peers such as `@angular/ssr`.
|
|
16
18
|
const angularBuildExecutors = [
|
|
17
19
|
'@nx/angular:application',
|
|
18
20
|
'@nx/angular:unit-test',
|
|
@@ -51,5 +53,7 @@ async function default_1(tree) {
|
|
|
51
53
|
return;
|
|
52
54
|
}
|
|
53
55
|
(0, acknowledge_build_scripts_1.acknowledgeAngularBuildScripts)(tree);
|
|
54
|
-
|
|
56
|
+
const version = (0, internal_1.getInstalledPackageVersionFromTree)(tree, '@angular-devkit/build-angular') ??
|
|
57
|
+
(0, version_utils_1.getInstalledAngularVersion)(tree);
|
|
58
|
+
return (0, devkit_1.addDependenciesToPackageJson)(tree, {}, { '@angular/build': `~${version}` }, undefined, true);
|
|
55
59
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#### Add `@angular/build` When Used by an Executor
|
|
2
2
|
|
|
3
|
-
The `@nx/angular:application` and `@nx/angular:unit-test` executors load the Angular builders by importing `@angular/build` directly, and any `@angular/build:*` executor is provided by that package, so `@angular/build` is a required runtime dependency for workspaces using those targets. Nothing declares it as a direct dependency, though: it has only ever been available transitively as a dependency of `@angular-devkit/build-angular`. That is not reliable (for example, under Yarn Berry it can be missing from `node_modules` even when `@angular-devkit/build-angular` is installed), and when `@angular/build` cannot be resolved the build fails with an error like `The "@angular/build" package is required by "@nx/angular:application" but is not installed`. This migration adds `@angular/build` to `devDependencies` when a project uses one of those executors and it is not already installed,
|
|
3
|
+
The `@nx/angular:application` and `@nx/angular:unit-test` executors load the Angular builders by importing `@angular/build` directly, and any `@angular/build:*` executor is provided by that package, so `@angular/build` is a required runtime dependency for workspaces using those targets. Nothing declares it as a direct dependency, though: it has only ever been available transitively as a dependency of `@angular-devkit/build-angular`. That is not reliable (for example, under Yarn Berry it can be missing from `node_modules` even when `@angular-devkit/build-angular` is installed), and when `@angular/build` cannot be resolved the build fails with an error like `The "@angular/build" package is required by "@nx/angular:application" but is not installed`. This migration adds `@angular/build` to `devDependencies` when a project uses one of those executors and it is not already installed. It uses the installed `@angular-devkit/build-angular` version, which pins `@angular/build` to the same version. When `@angular-devkit/build-angular` isn't installed, it uses the `@angular/core` version declared in `package.json`, limited to that minor (`^22.1.0` becomes `~22.1.0`). An existing version is preserved.
|
|
4
4
|
|
|
5
5
|
Executor usage is detected on any target using `@nx/angular:application`, `@nx/angular:unit-test`, or an `@angular/build:*` executor. Targets that inherit their executor from an `nx.json` `targetDefaults` entry are detected too.
|
|
6
6
|
|
|
@@ -32,14 +32,21 @@ async function default_1(tree) {
|
|
|
32
32
|
ts.isIdentifier(node.expression) &&
|
|
33
33
|
(node.expression.text === 'AngularNodeAppEngine' ||
|
|
34
34
|
node.expression.text === 'AngularAppEngine')) {
|
|
35
|
-
if (!node.arguments
|
|
35
|
+
if (!node.arguments) {
|
|
36
|
+
// `new AngularAppEngine` without parentheses has no argument list.
|
|
37
|
+
recorder ??= new file_change_recorder_1.FileChangeRecorder(tree, path);
|
|
38
|
+
recorder.insertRight(node.end, `({\n ${TODO_COMMENT}\n ${TRUST_PROXY_HEADERS}\n})`);
|
|
39
|
+
}
|
|
40
|
+
else if (node.arguments.length === 0) {
|
|
36
41
|
// No options object: insert one before the closing parenthesis.
|
|
37
42
|
recorder ??= new file_change_recorder_1.FileChangeRecorder(tree, path);
|
|
38
43
|
recorder.insertRight(node.end - 1, `{\n ${TODO_COMMENT}\n ${TRUST_PROXY_HEADERS}\n}`);
|
|
39
44
|
}
|
|
40
45
|
else if (ts.isObjectLiteralExpression(node.arguments[0])) {
|
|
41
46
|
const optionsArg = node.arguments[0];
|
|
42
|
-
|
|
47
|
+
// Any member kind counts (shorthand, method, accessor): adding the
|
|
48
|
+
// property next to one would duplicate the key.
|
|
49
|
+
const hasTrustProxyHeaders = optionsArg.properties.some((prop) => prop.name &&
|
|
43
50
|
(ts.isIdentifier(prop.name) || ts.isStringLiteral(prop.name)) &&
|
|
44
51
|
prop.name.text === 'trustProxyHeaders');
|
|
45
52
|
if (!hasTrustProxyHeaders) {
|