@nx/angular 21.1.2 → 21.2.0-beta.2
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/README.md +4 -4
- package/fesm2022/nx-angular-mf.mjs +10 -3
- package/fesm2022/nx-angular-mf.mjs.map +1 -1
- package/fesm2022/nx-angular.mjs.map +1 -1
- package/index.d.ts +2 -1
- package/mf/index.d.ts +71 -1
- package/migrations.json +106 -0
- package/ng-package.json +0 -1
- package/package.json +28 -16
- package/plugins/component-testing.js +8 -3
- package/src/builders/dev-server/dev-server.impl.js +4 -7
- package/src/builders/dev-server/lib/normalize-options.js +0 -6
- package/src/builders/dev-server/lib/validate-options.js +0 -4
- package/src/builders/dev-server/schema.d.ts +3 -15
- package/src/builders/dev-server/schema.json +3 -9
- package/src/builders/webpack-browser/webpack-browser.impl.js +2 -0
- package/src/builders/webpack-server/webpack-server.impl.d.ts +3 -1
- package/src/builders/webpack-server/webpack-server.impl.js +2 -0
- package/src/executors/application/application.impl.d.ts +2 -2
- package/src/executors/application/application.impl.js +11 -6
- package/src/executors/application/schema.d.ts +1 -1
- package/src/executors/application/schema.json +21 -10
- package/src/executors/application/utils/normalize-options.js +8 -1
- package/src/executors/application/utils/validate-options.js +10 -40
- package/src/executors/extract-i18n/extract-i18n.impl.js +6 -14
- package/src/executors/extract-i18n/schema.d.ts +1 -6
- package/src/executors/extract-i18n/schema.json +5 -0
- package/src/executors/extract-i18n/utils/validate-options.d.ts +2 -0
- package/src/executors/extract-i18n/utils/validate-options.js +13 -0
- package/src/executors/module-federation-dev-server/lib/normalize-options.js +1 -7
- package/src/executors/module-federation-dev-server/schema.d.ts +3 -15
- package/src/executors/module-federation-dev-server/schema.json +2 -15
- package/src/executors/module-federation-ssr-dev-server/module-federation-ssr-dev-server.impl.js +10 -8
- package/src/executors/ng-packagr-lite/ng-packagr-adjustments/ng-package/entry-point/entry-point.d.ts +6 -3
- package/src/executors/ng-packagr-lite/ng-packagr-adjustments/ng-package/entry-point/entry-point.js +46 -8
- package/src/executors/ng-packagr-lite/ng-packagr-adjustments/ng-package/entry-point/write-bundles.di.d.ts +1 -1
- package/src/executors/ng-packagr-lite/ng-packagr-adjustments/ng-package/entry-point/write-bundles.di.js +3 -3
- package/src/executors/ng-packagr-lite/ng-packagr-adjustments/ng-package/entry-point/write-bundles.transform.d.ts +2 -2
- package/src/executors/ng-packagr-lite/ng-packagr-adjustments/ng-package/entry-point/write-bundles.transform.js +36 -7
- package/src/executors/ng-packagr-lite/schema.json +2 -3
- package/src/executors/package/package.impl.js +1 -5
- package/src/executors/package/schema.d.ts +3 -1
- package/src/executors/package/schema.json +2 -3
- package/src/executors/utilities/builder-package.d.ts +1 -0
- package/src/executors/utilities/builder-package.js +11 -0
- package/src/executors/utilities/esbuild-extensions.d.ts +2 -1
- package/src/executors/utilities/ng-packagr/package-imports.d.ts +3 -1
- package/src/executors/utilities/ng-packagr/package-imports.js +2 -2
- package/src/executors/utilities/ng-packagr/pre-v19/stylesheet-processor.d.ts +2 -24
- package/src/executors/utilities/ng-packagr/pre-v19/stylesheet-processor.js +40 -107
- package/src/executors/utilities/ng-packagr/stylesheet-processor.di.js +4 -8
- package/src/executors/utilities/ng-packagr/v19+/stylesheet-processor.d.ts +1 -1
- package/src/executors/utilities/ng-packagr/v19+/stylesheet-processor.js +18 -11
- package/src/generators/add-linting/add-linting.js +8 -0
- package/src/generators/application/application.js +22 -8
- package/src/generators/application/files/base/tsconfig.app.json__tpl__ +10 -1
- package/src/generators/application/files/base/tsconfig.json__tpl__ +7 -8
- package/src/generators/application/files/ng-module/src/app/app__componentFileSuffix__.spec.ts__tpl__ +28 -0
- package/src/generators/application/files/ng-module/src/app/{app.component.ts__tpl__ → app__componentFileSuffix__.ts__tpl__} +4 -4
- package/src/generators/application/files/ng-module/src/app/app__moduleTypeSeparator__module.ts__tpl__ +17 -0
- package/src/generators/application/files/ng-module/src/main.ts__tpl__ +11 -3
- package/src/generators/application/files/nx-welcome/claimed/ng-module/src/app/{nx-welcome.component.ts__tpl__ → nx-welcome__componentFileSuffix__.ts__tpl__} +1 -1
- package/src/generators/application/files/nx-welcome/claimed/standalone/src/app/{nx-welcome.component.ts__tpl__ → nx-welcome__componentFileSuffix__.ts__tpl__} +1 -1
- package/src/generators/application/files/nx-welcome/not-configured/ng-module/src/app/{nx-welcome.component.ts__tpl__ → nx-welcome__componentFileSuffix__.ts__tpl__} +1 -1
- package/src/generators/application/files/nx-welcome/not-configured/standalone/src/app/{nx-welcome.component.ts__tpl__ → nx-welcome__componentFileSuffix__.ts__tpl__} +1 -1
- package/src/generators/application/files/nx-welcome/unclaimed/ng-module/src/app/{nx-welcome.component.ts__tpl__ → nx-welcome__componentFileSuffix__.ts__tpl__} +1 -1
- package/src/generators/application/files/nx-welcome/unclaimed/standalone/src/app/{nx-welcome.component.ts__tpl__ → nx-welcome__componentFileSuffix__.ts__tpl__} +1 -1
- package/src/generators/application/files/standalone-components/src/app/app.config.ts__tpl__ +6 -2
- package/src/generators/application/files/standalone-components/src/app/app__componentFileSuffix__.spec.ts__tpl__ +27 -0
- package/src/generators/application/files/standalone-components/src/app/{app.component.ts__tpl__ → app__componentFileSuffix__.ts__tpl__} +6 -6
- package/src/generators/application/files/standalone-components/src/main.ts__tpl__ +2 -2
- package/src/generators/application/lib/create-files.d.ts +1 -1
- package/src/generators/application/lib/create-files.js +18 -19
- package/src/generators/application/lib/create-project.d.ts +1 -1
- package/src/generators/application/lib/create-project.js +119 -26
- package/src/generators/application/lib/enable-strict-type-checking.js +4 -2
- package/src/generators/application/lib/index.d.ts +1 -2
- package/src/generators/application/lib/index.js +1 -2
- package/src/generators/application/lib/set-generator-defaults.js +1 -0
- package/src/generators/application/lib/{update-editor-tsconfig.d.ts → update-tsconfig-files.d.ts} +1 -1
- package/src/generators/application/lib/update-tsconfig-files.js +93 -0
- package/src/generators/application/schema.json +1 -1
- package/src/generators/component/component.js +13 -2
- package/src/generators/component/files/__fileName__.ts__tpl__ +1 -1
- package/src/generators/component/lib/component.js +11 -1
- package/src/generators/component/lib/module.d.ts +7 -2
- package/src/generators/component/lib/module.js +7 -5
- package/src/generators/component/lib/normalize-options.js +7 -3
- package/src/generators/component/schema.d.ts +1 -0
- package/src/generators/component/schema.json +6 -2
- package/src/generators/convert-to-application-executor/convert-to-application-executor.js +37 -24
- package/src/generators/convert-to-rspack/convert-to-rspack.d.ts +1 -1
- package/src/generators/convert-to-rspack/convert-to-rspack.js +173 -28
- package/src/generators/convert-to-rspack/lib/get-custom-webpack-config.js +1 -1
- package/src/generators/directive/directive.js +1 -1
- package/src/generators/directive/lib/normalize-options.js +7 -2
- package/src/generators/directive/schema.d.ts +1 -0
- package/src/generators/directive/schema.json +10 -2
- package/src/generators/host/host.js +21 -1
- package/src/generators/host/schema.d.ts +1 -0
- package/src/generators/host/schema.json +7 -1
- package/src/generators/init/init.js +1 -1
- package/src/generators/library/files/base/tsconfig.json__tpl__ +5 -5
- package/src/generators/library/files/ng-module/src/index.ts__tpl__ +1 -1
- package/src/generators/library/files/standalone-components/src/lib/lib.routes.ts__tpl__ +2 -2
- package/src/generators/library/lib/add-standalone-component.js +1 -0
- package/src/generators/library/lib/create-files.js +10 -3
- package/src/generators/library/lib/normalize-options.d.ts +3 -3
- package/src/generators/library/lib/normalize-options.js +6 -1
- package/src/generators/library/lib/normalized-schema.d.ts +2 -0
- package/src/generators/library/lib/set-generator-defaults.js +1 -0
- package/src/generators/library/lib/update-tsconfig-files.d.ts +3 -0
- package/src/generators/library/lib/update-tsconfig-files.js +98 -0
- package/src/generators/library/library.js +19 -33
- package/src/generators/library-secondary-entry-point/files/src/index.ts__tmpl__ +1 -1
- package/src/generators/library-secondary-entry-point/lib/add-files.js +2 -1
- package/src/generators/library-secondary-entry-point/lib/normalize-options.d.ts +2 -2
- package/src/generators/library-secondary-entry-point/lib/normalize-options.js +3 -0
- package/src/generators/library-secondary-entry-point/schema.d.ts +1 -0
- package/src/generators/move/lib/update-module-name.js +17 -10
- package/src/generators/move/lib/update-secondary-entry-points.js +0 -3
- package/src/generators/ng-add/migrators/builders/angular-devkit-karma.migrator.js +1 -1
- package/src/generators/ng-add/migrators/projects/app.migrator.js +43 -8
- package/src/generators/ngrx/schema.json +3 -3
- package/src/generators/ngrx-root-store/lib/normalize-options.js +9 -2
- package/src/generators/pipe/lib/normalize-options.js +4 -0
- package/src/generators/pipe/pipe.js +1 -1
- package/src/generators/pipe/schema.d.ts +1 -0
- package/src/generators/pipe/schema.json +11 -2
- package/src/generators/remote/files/standalone/src/bootstrap.server.ts__tmpl__ +4 -4
- package/src/generators/remote/lib/update-ssr-setup.js +5 -0
- package/src/generators/remote/remote.js +23 -0
- package/src/generators/remote/schema.d.ts +1 -0
- package/src/generators/remote/schema.json +7 -1
- package/src/generators/scam/lib/convert-component-to-scam.js +1 -3
- package/src/generators/scam/lib/normalize-options.js +11 -3
- package/src/generators/scam/schema.d.ts +1 -0
- package/src/generators/scam/schema.json +1 -2
- package/src/generators/scam-directive/lib/convert-directive-to-scam.js +1 -3
- package/src/generators/scam-directive/lib/normalize-options.js +11 -2
- package/src/generators/scam-directive/schema.d.ts +2 -0
- package/src/generators/scam-directive/schema.json +10 -2
- package/src/generators/scam-pipe/lib/convert-pipe-to-scam.js +1 -3
- package/src/generators/scam-pipe/lib/normalize-options.js +8 -0
- package/src/generators/scam-pipe/schema.d.ts +2 -0
- package/src/generators/scam-pipe/schema.json +5 -0
- package/src/generators/setup-mf/files/entry-module-files/{entry.module.ts__tmpl__ → __entryModuleFileName__.ts__tmpl__} +4 -4
- package/src/generators/setup-mf/files/entry-module-files/entry.routes.ts__tmpl__ +2 -2
- package/src/generators/setup-mf/files/entry-module-files/{entry.component.ts__tmpl__ → entry__componentFileSuffix__.ts__tmpl__} +1 -1
- package/src/generators/setup-mf/files/host-files/__appFileName__.spec.ts__tmpl__ +43 -0
- package/src/generators/setup-mf/files/standalone-entry-component-files/entry.routes.ts__tmpl__ +2 -2
- package/src/generators/setup-mf/files/standalone-entry-component-files/{entry.component.ts__tmpl__ → entry__componentFileSuffix__.ts__tmpl__} +3 -3
- package/src/generators/setup-mf/files/ts-webpack/module-federation.config.ts__tmpl__ +1 -1
- package/src/generators/setup-mf/files/ts-webpack/tsconfig.lint.json__tmpl__ +1 -1
- package/src/generators/setup-mf/files/webpack/module-federation.config.js__tmpl__ +1 -1
- package/src/generators/setup-mf/lib/add-remote-entry.d.ts +2 -2
- package/src/generators/setup-mf/lib/add-remote-entry.js +9 -3
- package/src/generators/setup-mf/lib/add-remote-to-host.js +11 -1
- package/src/generators/setup-mf/lib/fix-bootstrap.d.ts +2 -2
- package/src/generators/setup-mf/lib/fix-bootstrap.js +4 -4
- package/src/generators/setup-mf/lib/generate-config.d.ts +2 -2
- package/src/generators/setup-mf/lib/generate-config.js +1 -0
- package/src/generators/setup-mf/lib/normalize-options.d.ts +1 -1
- package/src/generators/setup-mf/lib/normalize-options.js +13 -0
- package/src/generators/setup-mf/lib/remove-dead-code-from-remote.d.ts +2 -2
- package/src/generators/setup-mf/lib/remove-dead-code-from-remote.js +18 -14
- package/src/generators/setup-mf/lib/setup-host-if-dynamic.js +1 -5
- package/src/generators/setup-mf/lib/setup-tspath-for-remote.d.ts +2 -2
- package/src/generators/setup-mf/lib/setup-tspath-for-remote.js +1 -1
- package/src/generators/setup-mf/lib/update-host-app-routes.d.ts +2 -2
- package/src/generators/setup-mf/lib/update-host-app-routes.js +12 -9
- package/src/generators/setup-mf/lib/update-tsconfig.d.ts +2 -2
- package/src/generators/setup-mf/lib/update-tsconfig.js +5 -5
- package/src/generators/setup-mf/schema.d.ts +7 -0
- package/src/generators/setup-mf/setup-mf.d.ts +2 -2
- package/src/generators/setup-mf/setup-mf.js +16 -6
- package/src/generators/setup-ssr/files/v20+/application-builder/ngmodule-src/__main__ +1 -0
- package/src/generators/setup-ssr/files/v20+/application-builder/ngmodule-src/app/__rootModuleFileName__ +12 -0
- package/src/generators/setup-ssr/files/v20+/application-builder/ngmodule-src/app/app.routes.server.ts__tpl__ +8 -0
- package/src/generators/setup-ssr/files/v20+/application-builder/server/__serverFileName__ +66 -0
- package/src/generators/setup-ssr/files/v20+/application-builder/standalone-src/__main__ +7 -0
- package/src/generators/setup-ssr/files/v20+/application-builder/standalone-src/app/app.config.server.ts__tpl__ +12 -0
- package/src/generators/setup-ssr/files/v20+/application-builder/standalone-src/app/app.routes.server.ts__tpl__ +8 -0
- package/src/generators/setup-ssr/files/v20+/server-builder/ngmodule-src/__main__ +1 -0
- package/src/generators/setup-ssr/files/v20+/server-builder/ngmodule-src/app/__rootModuleFileName__ +14 -0
- package/src/generators/setup-ssr/files/v20+/server-builder/root/tsconfig.server.json.template +18 -0
- package/src/generators/setup-ssr/files/v20+/server-builder/server/__serverFileName__ +69 -0
- package/src/generators/setup-ssr/files/v20+/server-builder/standalone-src/__main__ +7 -0
- package/src/generators/setup-ssr/files/v20+/server-builder/standalone-src/app/app.config.server.ts.template +11 -0
- package/src/generators/setup-ssr/lib/add-dependencies.js +11 -8
- package/src/generators/setup-ssr/lib/add-hydration.js +10 -3
- package/src/generators/setup-ssr/lib/add-server-file.js +7 -2
- package/src/generators/setup-ssr/lib/generate-files.js +17 -4
- package/src/generators/setup-ssr/lib/generate-server-ts-config.js +32 -6
- package/src/generators/setup-ssr/lib/normalize-options.js +5 -3
- package/src/generators/setup-ssr/lib/update-project-config.js +5 -0
- package/src/generators/setup-ssr/lib/validate-options.js +2 -2
- package/src/generators/setup-ssr/schema.d.ts +1 -0
- package/src/generators/setup-ssr/schema.json +1 -1
- package/src/generators/utils/add-jest.js +6 -1
- package/src/generators/utils/app-components-info.d.ts +9 -0
- package/src/generators/utils/app-components-info.js +39 -0
- package/src/generators/utils/artifact-types.d.ts +3 -0
- package/src/generators/utils/artifact-types.js +33 -0
- package/src/generators/utils/assert-mf-utils.d.ts +1 -0
- package/src/generators/utils/assert-mf-utils.js +11 -0
- package/src/generators/utils/ensure-angular-dependencies.js +6 -3
- package/src/generators/utils/export-scam.d.ts +1 -0
- package/src/generators/utils/export-scam.js +1 -2
- package/src/generators/utils/find-module.js +18 -13
- package/src/generators/utils/storybook-ast/component-info.js +40 -24
- package/src/generators/utils/storybook-ast/module-info.d.ts +1 -1
- package/src/generators/utils/storybook-ast/module-info.js +3 -8
- package/src/generators/utils/testing.js +28 -28
- package/src/generators/utils/version-utils.js +2 -2
- package/src/generators/web-worker/lib/add-snippet.js +3 -3
- package/src/migrations/update-21-2-0/migrate-provide-server-rendering-import.d.ts +2 -0
- package/src/migrations/update-21-2-0/migrate-provide-server-rendering-import.js +110 -0
- package/src/migrations/update-21-2-0/replace-provide-server-routing.d.ts +2 -0
- package/src/migrations/update-21-2-0/replace-provide-server-routing.js +103 -0
- package/src/migrations/update-21-2-0/set-generator-defaults-for-previous-style-guide.d.ts +2 -0
- package/src/migrations/update-21-2-0/set-generator-defaults-for-previous-style-guide.js +47 -0
- package/src/migrations/update-21-2-0/update-angular-cli.d.ts +3 -0
- package/src/migrations/update-21-2-0/update-angular-cli.js +23 -0
- package/src/migrations/update-21-2-0/update-module-resolution.d.ts +2 -0
- package/src/migrations/update-21-2-0/update-module-resolution.js +45 -0
- package/src/plugins/plugin.js +22 -13
- package/src/utils/backward-compatible-versions.d.ts +2 -2
- package/src/utils/backward-compatible-versions.js +22 -19
- package/src/utils/nx-devkit/ast-utils.js +17 -3
- package/src/utils/nx-devkit/testing.js +9 -9
- package/src/utils/targets.d.ts +2 -1
- package/src/utils/targets.js +6 -0
- package/src/utils/versions.d.ts +4 -3
- package/src/utils/versions.js +5 -4
- package/mf/mf.d.ts +0 -69
- package/src/generators/application/files/base-pre18/src/favicon.ico +0 -0
- package/src/generators/application/files/ng-module/src/app/app.component.spec.ts__tpl__ +0 -29
- package/src/generators/application/files/ng-module/src/app/app.module.ts__tpl__ +0 -17
- package/src/generators/application/files/standalone-components/src/app/app.component.__style__ +0 -0
- package/src/generators/application/files/standalone-components/src/app/app.component.spec.ts__tpl__ +0 -28
- package/src/generators/application/lib/set-app-strict-default.d.ts +0 -2
- package/src/generators/application/lib/set-app-strict-default.js +0 -13
- package/src/generators/application/lib/update-editor-tsconfig.js +0 -21
- package/src/generators/library/lib/enable-strict-type-checking.d.ts +0 -7
- package/src/generators/library/lib/enable-strict-type-checking.js +0 -47
- package/src/generators/library/lib/update-tsconfig.d.ts +0 -3
- package/src/generators/library/lib/update-tsconfig.js +0 -36
- package/src/generators/setup-mf/files/host-files/app.component.spec.ts__tmpl__ +0 -47
- /package/src/generators/application/files/{base-18+ → base}/public/favicon.ico +0 -0
- /package/src/generators/application/files/{base-pre18/src/assets/.gitkeep__tpl__ → ng-module/src/app/app__componentFileSuffix__.__style__} +0 -0
- /package/src/generators/application/files/ng-module/src/app/{app.component.html__tpl__ → app__componentFileSuffix__.html__tpl__} +0 -0
- /package/src/generators/application/files/{ng-module/src/app/app.component.__style__ → standalone-components/src/app/app__componentFileSuffix__.__style__} +0 -0
- /package/src/generators/application/files/standalone-components/src/app/{app.component.html__tpl__ → app__componentFileSuffix__.html__tpl__} +0 -0
- /package/src/generators/component/files/{__fileName__.html__tpl__ → __fileName____ngext__.html__tpl__} +0 -0
- /package/src/generators/library/files/ng-module/src/lib/{__libFileName__.module.ts__tpl__ → __libFileName____moduleTypeSeparator__module.ts__tpl__} +0 -0
- /package/src/generators/library-secondary-entry-point/files/src/lib/{__fileName__.module.ts__tmpl__ → __fileName____moduleTypeSeparator__module.ts__tmpl__} +0 -0
- /package/src/generators/setup-ssr/files/{v19+ → v19}/application-builder/ngmodule-src/__main__ +0 -0
- /package/src/generators/setup-ssr/files/{v19+ → v19}/application-builder/ngmodule-src/app/__rootModuleFileName__ +0 -0
- /package/src/generators/setup-ssr/files/{v19+ → v19}/application-builder/ngmodule-src/app/app.routes.server.ts__tpl__ +0 -0
- /package/src/generators/setup-ssr/files/{v19+ → v19}/application-builder/server/__serverFileName__ +0 -0
- /package/src/generators/setup-ssr/files/{v19+ → v19}/application-builder/standalone-src/__main__ +0 -0
- /package/src/generators/setup-ssr/files/{v19+ → v19}/application-builder/standalone-src/app/app.config.server.ts__tpl__ +0 -0
- /package/src/generators/setup-ssr/files/{v19+ → v19}/application-builder/standalone-src/app/app.routes.server.ts__tpl__ +0 -0
- /package/src/generators/setup-ssr/files/{v19+ → v19}/application-builder-common-engine/server/__serverFileName__ +0 -0
- /package/src/generators/setup-ssr/files/{v19+ → v19}/server-builder/ngmodule-src/__main__ +0 -0
- /package/src/generators/setup-ssr/files/{v19+ → v19}/server-builder/ngmodule-src/app/__rootModuleFileName__ +0 -0
- /package/src/generators/setup-ssr/files/{v19+ → v19}/server-builder/root/tsconfig.server.json.template +0 -0
- /package/src/generators/setup-ssr/files/{v19+ → v19}/server-builder/server/__serverFileName__ +0 -0
- /package/src/generators/setup-ssr/files/{v19+ → v19}/server-builder/standalone-src/__main__ +0 -0
- /package/src/generators/setup-ssr/files/{v19+ → v19}/server-builder/standalone-src/app/app.config.server.ts.template +0 -0
@@ -7,7 +7,6 @@ const buildable_libs_utils_1 = require("@nx/js/src/utils/buildable-libs-utils");
|
|
7
7
|
const path_1 = require("path");
|
8
8
|
const rxjs_1 = require("rxjs");
|
9
9
|
const operators_1 = require("rxjs/operators");
|
10
|
-
const angular_version_utils_1 = require("../utilities/angular-version-utils");
|
11
10
|
const typescript_1 = require("../utilities/typescript");
|
12
11
|
const ng_packagr_1 = require("./ng-packagr-adjustments/ng-packagr");
|
13
12
|
async function initializeNgPackagr(options, context, projectDependencies) {
|
@@ -27,10 +26,7 @@ async function initializeNgPackagr(options, context, projectDependencies) {
|
|
27
26
|
*/
|
28
27
|
function createLibraryExecutor(initializeNgPackagr) {
|
29
28
|
return async function* (options, context) {
|
30
|
-
|
31
|
-
if (angularMajorVersion < 18 && options.poll !== undefined) {
|
32
|
-
throw new Error(`The "poll" option requires Angular version 18.0.0 or greater. You are currently using version ${angularVersion}.`);
|
33
|
-
}
|
29
|
+
options.project ??= (0, path_1.join)(context.projectsConfigurations.projects[context.projectName].root, 'ng-package.json');
|
34
30
|
const { dependencies } = (0, buildable_libs_utils_1.calculateProjectBuildableDependencies)(context.taskGraph, context.projectGraph, context.root, context.projectName, context.targetName, context.configurationName);
|
35
31
|
if (options.watch) {
|
36
32
|
return yield* (0, rxjs_for_await_1.eachValueFrom)((0, rxjs_1.from)(initializeNgPackagr(options, context, dependencies)).pipe((0, operators_1.switchMap)((packagr) => packagr.watch()), (0, operators_1.mapTo)({ success: true })));
|
@@ -31,9 +31,8 @@
|
|
31
31
|
},
|
32
32
|
"poll": {
|
33
33
|
"type": "number",
|
34
|
-
"description": "Enable and define the file watching poll time period in milliseconds.
|
34
|
+
"description": "Enable and define the file watching poll time period in milliseconds."
|
35
35
|
}
|
36
36
|
},
|
37
|
-
"additionalProperties": false
|
38
|
-
"required": ["project"]
|
37
|
+
"additionalProperties": false
|
39
38
|
}
|
@@ -0,0 +1 @@
|
|
1
|
+
export declare function assertBuilderPackageIsInstalled(packageName: string): void;
|
@@ -0,0 +1,11 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.assertBuilderPackageIsInstalled = assertBuilderPackageIsInstalled;
|
4
|
+
function assertBuilderPackageIsInstalled(packageName) {
|
5
|
+
try {
|
6
|
+
require.resolve(packageName);
|
7
|
+
}
|
8
|
+
catch {
|
9
|
+
throw new Error(`This executor requires the package ${packageName} to be installed. Please make sure it is installed and try again.`);
|
10
|
+
}
|
11
|
+
}
|
@@ -1,4 +1,5 @@
|
|
1
|
-
type
|
1
|
+
import type { buildApplication } from '@angular/build';
|
2
|
+
type Plugin = Parameters<typeof buildApplication>[2]['codePlugins'][number];
|
2
3
|
export type PluginSpec = {
|
3
4
|
path: string;
|
4
5
|
options: any;
|
@@ -1 +1,3 @@
|
|
1
|
-
|
1
|
+
type NgPackagrImportPath = `ng-packagr/src/${string}`;
|
2
|
+
export declare function importNgPackagrPath<T>(path: NgPackagrImportPath, ngPackagrMajorVersion: number): T;
|
3
|
+
export {};
|
@@ -3,8 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.importNgPackagrPath = importNgPackagrPath;
|
4
4
|
function importNgPackagrPath(path, ngPackagrMajorVersion) {
|
5
5
|
let finalPath = path;
|
6
|
-
if (ngPackagrMajorVersion
|
7
|
-
finalPath = path.replace(/^ng-packagr\//, 'ng-packagr/
|
6
|
+
if (ngPackagrMajorVersion < 20 && path.startsWith('ng-packagr/src/')) {
|
7
|
+
finalPath = path.replace(/^ng-packagr\/src\//, 'ng-packagr/');
|
8
8
|
}
|
9
9
|
return require(finalPath);
|
10
10
|
}
|
@@ -2,8 +2,8 @@
|
|
2
2
|
* Adapted from the original ng-packagr source.
|
3
3
|
*
|
4
4
|
* Changes made:
|
5
|
-
* -
|
6
|
-
*
|
5
|
+
* - Resolve `piscina` from the installed `ng-packagr` package.
|
6
|
+
* - Additionally search for the TailwindCSS config in the workspace root.
|
7
7
|
*/
|
8
8
|
export declare enum CssUrl {
|
9
9
|
inline = "inline",
|
@@ -25,25 +25,3 @@ export declare class StylesheetProcessor {
|
|
25
25
|
destroy(): void;
|
26
26
|
private createRenderWorker;
|
27
27
|
}
|
28
|
-
/**
|
29
|
-
* This class is used when ng-packagr version is 17.2.0. The async `loadPostcssConfiguration` function
|
30
|
-
* introduced in ng-packagr 17.2.0 causes a memory leak due to multiple workers being created. We must
|
31
|
-
* keep this class to support any workspace that might be using ng-packagr 17.2.0 where that function
|
32
|
-
* need to be awaited.
|
33
|
-
*/
|
34
|
-
export declare class AsyncStylesheetProcessor {
|
35
|
-
private readonly projectBasePath;
|
36
|
-
private readonly basePath;
|
37
|
-
private readonly cssUrl?;
|
38
|
-
private readonly includePaths?;
|
39
|
-
private readonly cacheDirectory?;
|
40
|
-
private renderWorker;
|
41
|
-
constructor(projectBasePath: string, basePath: string, cssUrl?: CssUrl, includePaths?: string[], cacheDirectory?: string | false);
|
42
|
-
process({ filePath, content, }: {
|
43
|
-
filePath: string;
|
44
|
-
content: string;
|
45
|
-
}): Promise<string>;
|
46
|
-
/** Destory workers in pool. */
|
47
|
-
destroy(): void;
|
48
|
-
private createRenderWorker;
|
49
|
-
}
|
@@ -3,22 +3,17 @@
|
|
3
3
|
* Adapted from the original ng-packagr source.
|
4
4
|
*
|
5
5
|
* Changes made:
|
6
|
-
* -
|
7
|
-
*
|
6
|
+
* - Resolve `piscina` from the installed `ng-packagr` package.
|
7
|
+
* - Additionally search for the TailwindCSS config in the workspace root.
|
8
8
|
*/
|
9
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
10
|
-
exports.
|
10
|
+
exports.StylesheetProcessor = exports.CssUrl = void 0;
|
11
11
|
const tslib_1 = require("tslib");
|
12
|
+
const devkit_1 = require("@nx/devkit");
|
12
13
|
const browserslist_1 = tslib_1.__importDefault(require("browserslist"));
|
13
14
|
const fs_1 = require("fs");
|
15
|
+
const color_1 = require("ng-packagr/src/lib/utils/color");
|
14
16
|
const path_1 = require("path");
|
15
|
-
const Piscina = require('piscina');
|
16
|
-
const color_1 = require("ng-packagr/lib/utils/color");
|
17
|
-
// using this instead of the one from ng-packagr
|
18
|
-
const tailwindcss_1 = require("../tailwindcss");
|
19
|
-
const devkit_1 = require("@nx/devkit");
|
20
|
-
const semver_1 = require("semver");
|
21
|
-
const ng_packagr_version_1 = require("../ng-packagr-version");
|
22
17
|
const maxWorkersVariable = process.env['NG_BUILD_MAX_WORKERS'];
|
23
18
|
const maxThreads = typeof maxWorkersVariable === 'string' && maxWorkersVariable !== ''
|
24
19
|
? +maxWorkersVariable
|
@@ -72,25 +67,16 @@ class StylesheetProcessor {
|
|
72
67
|
currentDir = (0, path_1.dirname)(prevDir);
|
73
68
|
}
|
74
69
|
const browserslistData = (0, browserslist_1.default)(undefined, { path: this.basePath });
|
75
|
-
const {
|
76
|
-
let
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
devkit_1.workspaceRoot,
|
86
|
-
]);
|
87
|
-
tailwindConfigPath = findTailwindConfiguration(searchDirs);
|
88
|
-
}
|
89
|
-
else if ((0, semver_1.gt)(ngPackagrVersion, '17.2.0')) {
|
90
|
-
const { loadPostcssConfiguration, } = require('ng-packagr/lib/styles/postcss-configuration');
|
91
|
-
postcssConfiguration = loadPostcssConfiguration(this.projectBasePath);
|
92
|
-
tailwindConfigPath = (0, tailwindcss_1.getTailwindConfigPath)(this.projectBasePath, devkit_1.workspaceRoot);
|
93
|
-
}
|
70
|
+
const { findTailwindConfiguration, generateSearchDirectories, loadPostcssConfiguration, } = require('ng-packagr/lib/styles/postcss-configuration');
|
71
|
+
let searchDirs = generateSearchDirectories([this.projectBasePath]);
|
72
|
+
const postcssConfiguration = loadPostcssConfiguration(searchDirs);
|
73
|
+
// (nx-specific): we support loading the TailwindCSS config from the root of the workspace
|
74
|
+
searchDirs = generateSearchDirectories([
|
75
|
+
this.projectBasePath,
|
76
|
+
devkit_1.workspaceRoot,
|
77
|
+
]);
|
78
|
+
const tailwindConfigPath = findTailwindConfiguration(searchDirs);
|
79
|
+
const Piscina = getPiscina();
|
94
80
|
this.renderWorker = new Piscina({
|
95
81
|
filename: require.resolve('ng-packagr/lib/styles/stylesheet-processor-worker'),
|
96
82
|
maxThreads,
|
@@ -113,84 +99,6 @@ class StylesheetProcessor {
|
|
113
99
|
}
|
114
100
|
}
|
115
101
|
exports.StylesheetProcessor = StylesheetProcessor;
|
116
|
-
/**
|
117
|
-
* This class is used when ng-packagr version is 17.2.0. The async `loadPostcssConfiguration` function
|
118
|
-
* introduced in ng-packagr 17.2.0 causes a memory leak due to multiple workers being created. We must
|
119
|
-
* keep this class to support any workspace that might be using ng-packagr 17.2.0 where that function
|
120
|
-
* need to be awaited.
|
121
|
-
*/
|
122
|
-
class AsyncStylesheetProcessor {
|
123
|
-
constructor(projectBasePath, basePath, cssUrl, includePaths, cacheDirectory) {
|
124
|
-
this.projectBasePath = projectBasePath;
|
125
|
-
this.basePath = basePath;
|
126
|
-
this.cssUrl = cssUrl;
|
127
|
-
this.includePaths = includePaths;
|
128
|
-
this.cacheDirectory = cacheDirectory;
|
129
|
-
// By default, browserslist defaults are too inclusive
|
130
|
-
// https://github.com/browserslist/browserslist/blob/83764ea81ffaa39111c204b02c371afa44a4ff07/index.js#L516-L522
|
131
|
-
// We change the default query to browsers that Angular support.
|
132
|
-
// https://angular.io/guide/browser-support
|
133
|
-
browserslist_1.default.defaults = [
|
134
|
-
'last 2 Chrome versions',
|
135
|
-
'last 1 Firefox version',
|
136
|
-
'last 2 Edge major versions',
|
137
|
-
'last 2 Safari major versions',
|
138
|
-
'last 2 iOS major versions',
|
139
|
-
'Firefox ESR',
|
140
|
-
];
|
141
|
-
}
|
142
|
-
async process({ filePath, content, }) {
|
143
|
-
await this.createRenderWorker();
|
144
|
-
return this.renderWorker.run({ content, filePath });
|
145
|
-
}
|
146
|
-
/** Destory workers in pool. */
|
147
|
-
destroy() {
|
148
|
-
void this.renderWorker?.destroy();
|
149
|
-
}
|
150
|
-
async createRenderWorker() {
|
151
|
-
if (this.renderWorker) {
|
152
|
-
return;
|
153
|
-
}
|
154
|
-
const styleIncludePaths = [...this.includePaths];
|
155
|
-
let prevDir = null;
|
156
|
-
let currentDir = this.basePath;
|
157
|
-
while (currentDir !== prevDir) {
|
158
|
-
const p = (0, path_1.join)(currentDir, 'node_modules');
|
159
|
-
if ((0, fs_1.existsSync)(p)) {
|
160
|
-
styleIncludePaths.push(p);
|
161
|
-
}
|
162
|
-
prevDir = currentDir;
|
163
|
-
currentDir = (0, path_1.dirname)(prevDir);
|
164
|
-
}
|
165
|
-
const browserslistData = (0, browserslist_1.default)(undefined, { path: this.basePath });
|
166
|
-
const { version: ngPackagrVersion } = (0, ng_packagr_version_1.getNgPackagrVersionInfo)();
|
167
|
-
let postcssConfiguration;
|
168
|
-
if (ngPackagrVersion === '17.2.0') {
|
169
|
-
const { loadPostcssConfiguration, } = require('ng-packagr/lib/styles/postcss-configuration');
|
170
|
-
postcssConfiguration = await loadPostcssConfiguration(this.projectBasePath);
|
171
|
-
}
|
172
|
-
this.renderWorker = new Piscina({
|
173
|
-
filename: require.resolve('ng-packagr/lib/styles/stylesheet-processor-worker'),
|
174
|
-
maxThreads,
|
175
|
-
recordTiming: false,
|
176
|
-
env: {
|
177
|
-
...process.env,
|
178
|
-
FORCE_COLOR: '' + color_1.colors.enabled,
|
179
|
-
},
|
180
|
-
workerData: {
|
181
|
-
postcssConfiguration,
|
182
|
-
tailwindConfigPath: (0, tailwindcss_1.getTailwindConfigPath)(this.projectBasePath, devkit_1.workspaceRoot),
|
183
|
-
projectBasePath: this.projectBasePath,
|
184
|
-
browserslistData,
|
185
|
-
targets: transformSupportedBrowsersToTargets(browserslistData),
|
186
|
-
cacheDirectory: this.cacheDirectory,
|
187
|
-
cssUrl: this.cssUrl,
|
188
|
-
styleIncludePaths,
|
189
|
-
},
|
190
|
-
});
|
191
|
-
}
|
192
|
-
}
|
193
|
-
exports.AsyncStylesheetProcessor = AsyncStylesheetProcessor;
|
194
102
|
function transformSupportedBrowsersToTargets(supportedBrowsers) {
|
195
103
|
const transformed = [];
|
196
104
|
// https://esbuild.github.io/api/#target
|
@@ -221,3 +129,28 @@ function transformSupportedBrowsersToTargets(supportedBrowsers) {
|
|
221
129
|
}
|
222
130
|
return transformed.length ? transformed : undefined;
|
223
131
|
}
|
132
|
+
/**
|
133
|
+
* Loads the `piscina` package from the installed `ng-packagr` package.
|
134
|
+
*/
|
135
|
+
function getPiscina() {
|
136
|
+
const ngPackagrPath = getInstalledNgPackagrPath();
|
137
|
+
try {
|
138
|
+
// Resolve the main piscina module entry point
|
139
|
+
const piscinaModulePath = require.resolve('piscina', {
|
140
|
+
paths: [ngPackagrPath],
|
141
|
+
});
|
142
|
+
return require(piscinaModulePath);
|
143
|
+
}
|
144
|
+
catch (error) {
|
145
|
+
throw new Error(`Failed to load the \`piscina\` package from \`ng-packagr\` dependencies: ${error.message}`);
|
146
|
+
}
|
147
|
+
}
|
148
|
+
function getInstalledNgPackagrPath() {
|
149
|
+
try {
|
150
|
+
const ngPackagrPackageJsonPath = require.resolve('ng-packagr/package.json');
|
151
|
+
return (0, path_1.dirname)(ngPackagrPackageJsonPath);
|
152
|
+
}
|
153
|
+
catch (e) {
|
154
|
+
throw new Error('The `ng-packagr` package is not installed. The package is required to use this executor. Please install it in your workspace.');
|
155
|
+
}
|
156
|
+
}
|
@@ -4,8 +4,8 @@ exports.getStylesheetProcessorFactoryProvider = getStylesheetProcessorFactoryPro
|
|
4
4
|
const ng_packagr_version_1 = require("./ng-packagr-version");
|
5
5
|
const package_imports_1 = require("./package-imports");
|
6
6
|
function getStylesheetProcessorFactoryProvider() {
|
7
|
-
const { major: ngPackagrMajorVersion
|
8
|
-
const { STYLESHEET_PROCESSOR_TOKEN } = (0, package_imports_1.importNgPackagrPath)('ng-packagr/lib/styles/stylesheet-processor.di', ngPackagrMajorVersion);
|
7
|
+
const { major: ngPackagrMajorVersion } = (0, ng_packagr_version_1.getNgPackagrVersionInfo)();
|
8
|
+
const { STYLESHEET_PROCESSOR_TOKEN } = (0, package_imports_1.importNgPackagrPath)('ng-packagr/src/lib/styles/stylesheet-processor.di', ngPackagrMajorVersion);
|
9
9
|
return {
|
10
10
|
provide: STYLESHEET_PROCESSOR_TOKEN,
|
11
11
|
useFactory: () => {
|
@@ -13,12 +13,8 @@ function getStylesheetProcessorFactoryProvider() {
|
|
13
13
|
const { getStylesheetProcessor, } = require('./v19+/stylesheet-processor');
|
14
14
|
return getStylesheetProcessor();
|
15
15
|
}
|
16
|
-
|
17
|
-
|
18
|
-
return StylesheetProcessor;
|
19
|
-
}
|
20
|
-
const { AsyncStylesheetProcessor, } = require('./pre-v19/stylesheet-processor');
|
21
|
-
return AsyncStylesheetProcessor;
|
16
|
+
const { StylesheetProcessor } = require('./pre-v19/stylesheet-processor');
|
17
|
+
return StylesheetProcessor;
|
22
18
|
},
|
23
19
|
deps: [],
|
24
20
|
};
|
@@ -4,7 +4,7 @@
|
|
4
4
|
* Changes made:
|
5
5
|
* - Add the project root to the search directories.
|
6
6
|
*/
|
7
|
-
import type { NgPackageEntryConfig } from 'ng-packagr/ng-entrypoint.schema';
|
7
|
+
import type { NgPackageEntryConfig } from 'ng-packagr/src/ng-entrypoint.schema';
|
8
8
|
export declare enum CssUrl {
|
9
9
|
inline = "inline",
|
10
10
|
none = "none"
|
@@ -20,22 +20,29 @@ var CssUrl;
|
|
20
20
|
})(CssUrl || (exports.CssUrl = CssUrl = {}));
|
21
21
|
function getStylesheetProcessor() {
|
22
22
|
const { major: ngPackagrMajorVersion } = (0, ng_packagr_version_1.getNgPackagrVersionInfo)();
|
23
|
-
const { ComponentStylesheetBundler } = (0, package_imports_1.importNgPackagrPath)('ng-packagr/lib/styles/component-stylesheets', ngPackagrMajorVersion);
|
24
|
-
const { generateSearchDirectories, getTailwindConfig, loadPostcssConfiguration, } = (0, package_imports_1.importNgPackagrPath)('ng-packagr/lib/styles/postcss-configuration', ngPackagrMajorVersion);
|
23
|
+
const { ComponentStylesheetBundler } = (0, package_imports_1.importNgPackagrPath)('ng-packagr/src/lib/styles/component-stylesheets', ngPackagrMajorVersion);
|
24
|
+
const { generateSearchDirectories, getTailwindConfig, loadPostcssConfiguration, } = (0, package_imports_1.importNgPackagrPath)('ng-packagr/src/lib/styles/postcss-configuration', ngPackagrMajorVersion);
|
25
25
|
class StylesheetProcessor extends ComponentStylesheetBundler {
|
26
26
|
constructor(projectBasePath, basePath, cssUrl, includePaths, sass, cacheDirectory, watch) {
|
27
27
|
// By default, browserslist defaults are too inclusive
|
28
28
|
// https://github.com/browserslist/browserslist/blob/83764ea81ffaa39111c204b02c371afa44a4ff07/index.js#L516-L522
|
29
29
|
// We change the default query to browsers that Angular support.
|
30
|
-
// https://angular.
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
30
|
+
// https://angular.dev/reference/versions#browser-support
|
31
|
+
if (ngPackagrMajorVersion >= 20) {
|
32
|
+
browserslist_1.default.defaults = (0, browserslist_1.default)(undefined, {
|
33
|
+
path: require.resolve('ng-packagr/.browserslistrc'),
|
34
|
+
});
|
35
|
+
}
|
36
|
+
else {
|
37
|
+
browserslist_1.default.defaults = [
|
38
|
+
'last 2 Chrome versions',
|
39
|
+
'last 1 Firefox version',
|
40
|
+
'last 2 Edge major versions',
|
41
|
+
'last 2 Safari major versions',
|
42
|
+
'last 2 iOS major versions',
|
43
|
+
'Firefox ESR',
|
44
|
+
];
|
45
|
+
}
|
39
46
|
const browserslistData = (0, browserslist_1.default)(undefined, { path: basePath });
|
40
47
|
let searchDirs = generateSearchDirectories([projectBasePath]);
|
41
48
|
const postcssConfiguration = loadPostcssConfiguration(searchDirs);
|
@@ -55,6 +55,10 @@ async function addLintingGenerator(tree, options) {
|
|
55
55
|
style: 'kebab-case',
|
56
56
|
},
|
57
57
|
],
|
58
|
+
// Temporary disable these rules until Angular ESLint recommended
|
59
|
+
// rules are updated with the new Style Guide
|
60
|
+
'@angular-eslint/component-class-suffix': 'off',
|
61
|
+
'@angular-eslint/directive-class-suffix': 'off',
|
58
62
|
},
|
59
63
|
});
|
60
64
|
(0, eslint_file_1.addOverrideToLintConfig)(tree, options.projectRoot, {
|
@@ -95,6 +99,10 @@ async function addLintingGenerator(tree, options) {
|
|
95
99
|
style: 'kebab-case',
|
96
100
|
},
|
97
101
|
],
|
102
|
+
// Temporary disable these rules until Angular ESLint recommended
|
103
|
+
// rules are updated with the new Style Guide
|
104
|
+
'@angular-eslint/component-class-suffix': 'off',
|
105
|
+
'@angular-eslint/directive-class-suffix': 'off',
|
98
106
|
},
|
99
107
|
},
|
100
108
|
{
|
@@ -5,11 +5,12 @@ const devkit_1 = require("@nx/devkit");
|
|
5
5
|
const log_show_project_command_1 = require("@nx/devkit/src/utils/log-show-project-command");
|
6
6
|
const js_1 = require("@nx/js");
|
7
7
|
const ts_solution_setup_1 = require("@nx/js/src/utils/typescript/ts-solution-setup");
|
8
|
-
const init_1 = require("../init/init");
|
9
8
|
const convert_to_rspack_1 = require("../convert-to-rspack/convert-to-rspack");
|
9
|
+
const init_1 = require("../init/init");
|
10
10
|
const setup_ssr_1 = require("../setup-ssr/setup-ssr");
|
11
11
|
const setup_tailwind_1 = require("../setup-tailwind/setup-tailwind");
|
12
12
|
const ensure_angular_dependencies_1 = require("../utils/ensure-angular-dependencies");
|
13
|
+
const version_utils_1 = require("../utils/version-utils");
|
13
14
|
const lib_1 = require("./lib");
|
14
15
|
async function applicationGenerator(tree, schema) {
|
15
16
|
(0, ts_solution_setup_1.assertNotUsingTsSolutionSetup)(tree, 'angular', 'application');
|
@@ -46,7 +47,7 @@ async function applicationGenerator(tree, schema) {
|
|
46
47
|
await (0, lib_1.addUnitTestRunner)(tree, options);
|
47
48
|
const e2ePort = await (0, lib_1.addE2e)(tree, options);
|
48
49
|
(0, lib_1.addServeStaticTarget)(tree, options, options.e2eTestRunner !== 'none' ? e2ePort : options.port);
|
49
|
-
(0, lib_1.
|
50
|
+
(0, lib_1.updateTsconfigFiles)(tree, options);
|
50
51
|
(0, lib_1.setGeneratorDefaults)(tree, options);
|
51
52
|
if (options.rootProject) {
|
52
53
|
const nxJson = (0, devkit_1.readNxJson)(tree);
|
@@ -56,12 +57,6 @@ async function applicationGenerator(tree, schema) {
|
|
56
57
|
if (options.backendProject) {
|
57
58
|
(0, lib_1.addProxyConfig)(tree, options);
|
58
59
|
}
|
59
|
-
if (options.strict) {
|
60
|
-
(0, lib_1.enableStrictTypeChecking)(tree, options);
|
61
|
-
}
|
62
|
-
else {
|
63
|
-
(0, lib_1.setApplicationStrictDefault)(tree, false);
|
64
|
-
}
|
65
60
|
if (options.ssr) {
|
66
61
|
await (0, setup_ssr_1.setupSsr)(tree, {
|
67
62
|
project: options.name,
|
@@ -83,6 +78,25 @@ async function applicationGenerator(tree, schema) {
|
|
83
78
|
});
|
84
79
|
}
|
85
80
|
}
|
81
|
+
if (!options.skipPackageJson) {
|
82
|
+
const { major: angularMajorVersion } = (0, version_utils_1.getInstalledAngularVersionInfo)(tree);
|
83
|
+
if (angularMajorVersion >= 20) {
|
84
|
+
const angularDevkitVersion = (0, version_utils_1.getInstalledAngularDevkitVersion)(tree) ??
|
85
|
+
(0, version_utils_1.versions)(tree).angularDevkitVersion;
|
86
|
+
const devDependencies = {};
|
87
|
+
if (options.bundler === 'esbuild') {
|
88
|
+
devDependencies['@angular/build'] = angularDevkitVersion;
|
89
|
+
}
|
90
|
+
else if (isRspack) {
|
91
|
+
devDependencies['@angular/build'] = angularDevkitVersion;
|
92
|
+
devDependencies['@angular-devkit/build-angular'] = angularDevkitVersion;
|
93
|
+
}
|
94
|
+
else {
|
95
|
+
devDependencies['@angular-devkit/build-angular'] = angularDevkitVersion;
|
96
|
+
}
|
97
|
+
(0, devkit_1.addDependenciesToPackageJson)(tree, {}, devDependencies, undefined, true);
|
98
|
+
}
|
99
|
+
}
|
86
100
|
if (!options.skipFormat) {
|
87
101
|
await (0, devkit_1.formatFiles)(tree);
|
88
102
|
}
|
@@ -4,7 +4,16 @@
|
|
4
4
|
"outDir": "<%= rootOffset %>dist/out-tsc",
|
5
5
|
"types": []
|
6
6
|
},
|
7
|
+
<%_ if (angularMajorVersion < 20) { _%>
|
7
8
|
"files": ["src/main.ts"],
|
8
9
|
"include": ["src/**/*.d.ts"],
|
9
|
-
|
10
|
+
<%_ } else { _%>
|
11
|
+
"include": ["src/**/*.ts"],
|
12
|
+
<%_ } _%>
|
13
|
+
"exclude": [
|
14
|
+
"jest.config.ts",
|
15
|
+
"src/test-setup.ts",
|
16
|
+
"src/**/*.test.ts",
|
17
|
+
"src/**/*.spec.ts"
|
18
|
+
]
|
10
19
|
}
|
@@ -1,18 +1,17 @@
|
|
1
1
|
{
|
2
|
-
"
|
3
|
-
|
4
|
-
|
5
|
-
"
|
2
|
+
"extends": "<%= rootTsConfig %>",
|
3
|
+
"compilerOptions": {},
|
4
|
+
"angularCompilerOptions": {
|
5
|
+
"enableI18nLegacyMessageIdFormat": false
|
6
6
|
},
|
7
7
|
"files": [],
|
8
8
|
"include": [],
|
9
|
-
"references": [
|
9
|
+
"references": [<% if (angularMajorVersion < 20) { %>
|
10
10
|
{
|
11
11
|
"path": "./tsconfig.editor.json"
|
12
|
-
}
|
12
|
+
},<% } %>
|
13
13
|
{
|
14
14
|
"path": "./tsconfig.app.json"
|
15
15
|
}
|
16
|
-
]
|
17
|
-
"extends": "<%= rootTsConfig %>"
|
16
|
+
]
|
18
17
|
}
|
package/src/generators/application/files/ng-module/src/app/app__componentFileSuffix__.spec.ts__tpl__
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
import { TestBed } from '@angular/core/testing';
|
2
|
+
import { App<%= componentType %> } from './app<%= componentFileSuffix %>';<% if(!minimal) { %>
|
3
|
+
import { NxWelcome<%= componentType %> } from './nx-welcome<%= componentFileSuffix %>';<% } %><% if(routing) { %>
|
4
|
+
import { RouterModule } from '@angular/router';<% } %>
|
5
|
+
|
6
|
+
describe('App<%= componentType %>', () => {
|
7
|
+
beforeEach(async () => {
|
8
|
+
await TestBed.configureTestingModule({
|
9
|
+
imports: [<% if(routing) { %>RouterModule.forRoot([])<% } %>],
|
10
|
+
declarations: [App<%= componentType %><% if(!minimal) { %>, NxWelcome<%= componentType %><% } %>]
|
11
|
+
}).compileComponents();
|
12
|
+
});
|
13
|
+
|
14
|
+
it('should render title', () => {
|
15
|
+
const fixture = TestBed.createComponent(App<%= componentType %>);
|
16
|
+
fixture.detectChanges();
|
17
|
+
const compiled = fixture.nativeElement as HTMLElement;
|
18
|
+
expect(compiled.querySelector('h1')?.textContent).toContain(
|
19
|
+
'Welcome <%= appName %>'
|
20
|
+
);
|
21
|
+
});<% if(!minimal && angularMajorVersion < 20) { %>
|
22
|
+
|
23
|
+
it(`should have as title '<%= appName %>'`, () => {
|
24
|
+
const fixture = TestBed.createComponent(App<%= componentType %>);
|
25
|
+
const app = fixture.componentInstance;
|
26
|
+
expect(app.title).toEqual('<%= appName %>');
|
27
|
+
});<% } %>
|
28
|
+
});
|
@@ -3,12 +3,12 @@ import { Component<% if(viewEncapsulation) { %>, ViewEncapsulation<% } %> } from
|
|
3
3
|
@Component({
|
4
4
|
selector: '<%= rootSelector %>',<% if (setStandaloneFalse) { %>
|
5
5
|
standalone: false,<% } if(!inlineTemplate) { %>
|
6
|
-
templateUrl: './app
|
6
|
+
templateUrl: './app<%= componentFileSuffix %>.html',<% } else { %>
|
7
7
|
template: `<% if(minimal) { %><h1>Welcome <%= appName %></h1><% } else { %><<%= nxWelcomeSelector %>></<%= nxWelcomeSelector %>><% } %> <% if(routing) { %><router-outlet></router-outlet><% } %>`,<% } %><% if(!inlineStyle) { %>
|
8
|
-
styleUrl: './app
|
8
|
+
styleUrl: './app<%= componentFileSuffix %>.<%= style %>',<% } else { %>
|
9
9
|
styles: ``,<% } %><% if(viewEncapsulation) { %>
|
10
10
|
encapsulation: ViewEncapsulation.<%= viewEncapsulation %>,<% } %>
|
11
11
|
})
|
12
|
-
export class
|
13
|
-
title = '<%= appName %>';
|
12
|
+
export class App<%= componentType %> {<% if(!minimal) { %>
|
13
|
+
<% if (angularMajorVersion >= 20) { %>protected <% } %>title = '<%= appName %>';
|
14
14
|
<% } %>}
|
@@ -0,0 +1,17 @@
|
|
1
|
+
import { NgModule<% if (provideGlobalErrorListener) { %>, provideBrowserGlobalErrorListeners<% } %> } from '@angular/core';
|
2
|
+
import { BrowserModule } from '@angular/platform-browser';<% if(routing) { %>
|
3
|
+
import { RouterModule } from '@angular/router';<% } %>
|
4
|
+
import { App<%= componentType %> } from './app<%= componentFileSuffix %>';<% if(routing) { %>
|
5
|
+
import { appRoutes } from './app.routes';<% } %><% if(!minimal) { %>
|
6
|
+
import { NxWelcome<%= componentType %> } from './nx-welcome<%= componentFileSuffix %>';<% } %>
|
7
|
+
|
8
|
+
@NgModule({
|
9
|
+
declarations: [App<%= componentType %><% if(!minimal) { %>, NxWelcome<%= componentType %><% } %>],
|
10
|
+
imports: [
|
11
|
+
BrowserModule,<% if(routing) { %>
|
12
|
+
RouterModule.forRoot(appRoutes),<% } %>
|
13
|
+
],
|
14
|
+
providers: [<% if (provideGlobalErrorListener) { %>provideBrowserGlobalErrorListeners()<% } %>],
|
15
|
+
bootstrap: [App<%= componentType %>],
|
16
|
+
})
|
17
|
+
export class AppModule {}
|
@@ -1,8 +1,16 @@
|
|
1
|
+
<%_ if (usePlatformBrowserDynamic) { _%>
|
1
2
|
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
|
2
|
-
|
3
|
+
<%_ } else { _%>
|
4
|
+
import { platformBrowser } from '@angular/platform-browser';
|
5
|
+
<%_ } _%>
|
6
|
+
import { AppModule } from './app/app<%= moduleTypeSeparator %>module';
|
3
7
|
|
8
|
+
<%_ if (usePlatformBrowserDynamic) { _%>
|
4
9
|
platformBrowserDynamic()
|
5
|
-
|
10
|
+
<%_ } else { _%>
|
11
|
+
platformBrowser()
|
12
|
+
<%_ } _%>
|
13
|
+
.bootstrapModule(AppModule, {
|
6
14
|
ngZoneEventCoalescing: true
|
7
|
-
}
|
15
|
+
})
|
8
16
|
.catch((err) => console.error(err));
|