@nx/angular 0.0.0-pr-30715-a5f5e3b → 0.0.0-pr-31313-387cdca
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/fesm2022/nx-angular-mf.mjs.map +1 -1
- package/fesm2022/nx-angular.mjs.map +1 -1
- package/index.d.ts +1 -2
- package/mf/index.d.ts +1 -71
- package/mf/mf.d.ts +69 -0
- package/migrations.json +0 -98
- package/package.json +16 -25
- package/plugins/component-testing.js +3 -8
- package/src/builders/dev-server/dev-server.impl.js +7 -4
- package/src/builders/dev-server/lib/normalize-options.js +6 -0
- package/src/builders/dev-server/lib/validate-options.js +4 -0
- package/src/builders/dev-server/schema.d.ts +15 -3
- package/src/builders/dev-server/schema.json +9 -3
- package/src/builders/webpack-browser/webpack-browser.impl.js +0 -2
- package/src/builders/webpack-server/webpack-server.impl.d.ts +1 -3
- package/src/builders/webpack-server/webpack-server.impl.js +0 -2
- package/src/executors/application/application.impl.d.ts +2 -2
- package/src/executors/application/application.impl.js +6 -11
- package/src/executors/application/schema.d.ts +1 -1
- package/src/executors/application/schema.json +10 -21
- package/src/executors/application/utils/normalize-options.js +1 -8
- package/src/executors/application/utils/validate-options.js +40 -10
- package/src/executors/extract-i18n/extract-i18n.impl.js +14 -6
- package/src/executors/extract-i18n/schema.d.ts +6 -1
- package/src/executors/module-federation-dev-server/lib/normalize-options.js +7 -1
- package/src/executors/module-federation-dev-server/schema.d.ts +15 -3
- package/src/executors/module-federation-dev-server/schema.json +15 -2
- package/src/executors/module-federation-ssr-dev-server/module-federation-ssr-dev-server.impl.js +8 -10
- package/src/executors/ng-packagr-lite/ng-packagr-adjustments/ng-package/entry-point/entry-point.d.ts +3 -6
- package/src/executors/ng-packagr-lite/ng-packagr-adjustments/ng-package/entry-point/entry-point.js +8 -46
- 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 +6 -22
- package/src/executors/ng-packagr-lite/schema.json +3 -2
- package/src/executors/package/package.impl.js +5 -1
- package/src/executors/package/schema.d.ts +1 -3
- package/src/executors/package/schema.json +3 -2
- package/src/executors/utilities/esbuild-extensions.d.ts +1 -2
- package/src/executors/utilities/ng-packagr/package-imports.d.ts +1 -3
- package/src/executors/utilities/ng-packagr/package-imports.js +2 -2
- package/src/executors/utilities/ng-packagr/pre-v19/stylesheet-processor.d.ts +24 -1
- package/src/executors/utilities/ng-packagr/pre-v19/stylesheet-processor.js +105 -12
- package/src/executors/utilities/ng-packagr/stylesheet-processor.di.js +8 -4
- package/src/executors/utilities/ng-packagr/v19+/stylesheet-processor.d.ts +1 -1
- package/src/executors/utilities/ng-packagr/v19+/stylesheet-processor.js +11 -18
- package/src/generators/add-linting/add-linting.js +0 -8
- package/src/generators/application/application.js +1 -21
- 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__ +29 -0
- package/src/generators/application/files/ng-module/src/app/{app__componentFileSuffix__.ts__tpl__ → app.component.ts__tpl__} +3 -3
- package/src/generators/application/files/ng-module/src/app/app.module.ts__tpl__ +17 -0
- package/src/generators/application/files/ng-module/src/main.ts__tpl__ +3 -11
- package/src/generators/application/files/nx-welcome/claimed/ng-module/src/app/{nx-welcome__componentFileSuffix__.ts__tpl__ → nx-welcome.component.ts__tpl__} +1 -1
- package/src/generators/application/files/nx-welcome/claimed/standalone/src/app/{nx-welcome__componentFileSuffix__.ts__tpl__ → nx-welcome.component.ts__tpl__} +1 -1
- package/src/generators/application/files/nx-welcome/not-configured/ng-module/src/app/{nx-welcome__componentFileSuffix__.ts__tpl__ → nx-welcome.component.ts__tpl__} +1 -1
- package/src/generators/application/files/nx-welcome/not-configured/standalone/src/app/{nx-welcome__componentFileSuffix__.ts__tpl__ → nx-welcome.component.ts__tpl__} +1 -1
- package/src/generators/application/files/nx-welcome/unclaimed/ng-module/src/app/{nx-welcome__componentFileSuffix__.ts__tpl__ → nx-welcome.component.ts__tpl__} +1 -1
- package/src/generators/application/files/nx-welcome/unclaimed/standalone/src/app/{nx-welcome__componentFileSuffix__.ts__tpl__ → nx-welcome.component.ts__tpl__} +1 -1
- 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__ +28 -0
- package/src/generators/application/files/standalone-components/src/app/{app__componentFileSuffix__.ts__tpl__ → app.component.ts__tpl__} +5 -5
- package/src/generators/application/files/standalone-components/src/app/app.config.ts__tpl__ +2 -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 +14 -15
- package/src/generators/application/lib/create-project.d.ts +1 -1
- package/src/generators/application/lib/create-project.js +26 -119
- package/src/generators/application/lib/enable-strict-type-checking.js +0 -3
- package/src/generators/application/schema.json +1 -1
- package/src/generators/component/component.js +2 -13
- package/src/generators/component/files/__fileName__.ts__tpl__ +1 -1
- package/src/generators/component/lib/component.js +1 -11
- package/src/generators/component/lib/module.d.ts +2 -7
- package/src/generators/component/lib/module.js +5 -7
- package/src/generators/component/lib/normalize-options.js +3 -7
- package/src/generators/component/schema.d.ts +0 -1
- package/src/generators/component/schema.json +2 -6
- package/src/generators/convert-to-application-executor/convert-to-application-executor.js +22 -19
- package/src/generators/convert-to-rspack/convert-to-rspack.js +2 -6
- 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 +2 -7
- package/src/generators/directive/schema.d.ts +0 -1
- package/src/generators/directive/schema.json +2 -10
- 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/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 +0 -1
- package/src/generators/library/lib/create-files.js +1 -10
- package/src/generators/library/lib/enable-strict-type-checking.d.ts +1 -1
- package/src/generators/library/lib/enable-strict-type-checking.js +0 -3
- package/src/generators/library/lib/normalize-options.d.ts +3 -3
- package/src/generators/library/lib/normalize-options.js +1 -6
- package/src/generators/library/lib/normalized-schema.d.ts +0 -2
- 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 +1 -2
- 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 +0 -3
- package/src/generators/library-secondary-entry-point/schema.d.ts +0 -1
- package/src/generators/move/lib/update-module-name.js +10 -17
- package/src/generators/move/lib/update-secondary-entry-points.js +3 -0
- package/src/generators/ng-add/migrators/builders/angular-devkit-karma.migrator.js +1 -1
- package/src/generators/ng-add/migrators/projects/app.migrator.js +8 -43
- package/src/generators/ngrx/schema.json +3 -3
- package/src/generators/ngrx-root-store/lib/normalize-options.js +2 -9
- package/src/generators/pipe/lib/normalize-options.js +0 -4
- package/src/generators/pipe/pipe.js +1 -1
- package/src/generators/pipe/schema.d.ts +0 -1
- package/src/generators/pipe/schema.json +2 -11
- package/src/generators/remote/files/standalone/src/bootstrap.server.ts__tmpl__ +4 -4
- package/src/generators/remote/lib/update-ssr-setup.js +0 -5
- 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 +3 -1
- package/src/generators/scam/lib/normalize-options.js +3 -11
- package/src/generators/scam/schema.d.ts +0 -1
- package/src/generators/scam/schema.json +2 -1
- package/src/generators/scam-directive/lib/convert-directive-to-scam.js +3 -1
- package/src/generators/scam-directive/lib/normalize-options.js +2 -11
- package/src/generators/scam-directive/schema.d.ts +0 -2
- package/src/generators/scam-directive/schema.json +2 -10
- package/src/generators/scam-pipe/lib/convert-pipe-to-scam.js +3 -1
- package/src/generators/scam-pipe/lib/normalize-options.js +0 -8
- package/src/generators/scam-pipe/schema.d.ts +0 -2
- package/src/generators/scam-pipe/schema.json +0 -5
- package/src/generators/setup-mf/files/entry-module-files/{entry__componentFileSuffix__.ts__tmpl__ → entry.component.ts__tmpl__} +1 -1
- package/src/generators/setup-mf/files/entry-module-files/{__entryModuleFileName__.ts__tmpl__ → entry.module.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/host-files/app.component.spec.ts__tmpl__ +47 -0
- package/src/generators/setup-mf/files/standalone-entry-component-files/{entry__componentFileSuffix__.ts__tmpl__ → entry.component.ts__tmpl__} +3 -3
- package/src/generators/setup-mf/files/standalone-entry-component-files/entry.routes.ts__tmpl__ +2 -2
- 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 +3 -9
- package/src/generators/setup-mf/lib/add-remote-to-host.js +1 -11
- 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 +0 -1
- package/src/generators/setup-mf/lib/normalize-options.d.ts +1 -1
- package/src/generators/setup-mf/lib/normalize-options.js +0 -13
- 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 +14 -18
- package/src/generators/setup-mf/lib/setup-host-if-dynamic.js +5 -1
- 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 +9 -12
- 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 +0 -7
- package/src/generators/setup-ssr/lib/add-dependencies.js +7 -4
- package/src/generators/setup-ssr/lib/add-hydration.js +3 -10
- package/src/generators/setup-ssr/lib/add-server-file.js +2 -7
- package/src/generators/setup-ssr/lib/generate-files.js +4 -17
- package/src/generators/setup-ssr/lib/generate-server-ts-config.js +2 -5
- package/src/generators/setup-ssr/lib/normalize-options.js +2 -2
- package/src/generators/setup-ssr/lib/update-project-config.js +0 -5
- package/src/generators/setup-ssr/lib/validate-options.js +2 -2
- package/src/generators/setup-ssr/schema.json +1 -1
- package/src/generators/utils/add-jest.js +1 -6
- 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 +3 -6
- package/src/generators/utils/export-scam.d.ts +0 -1
- package/src/generators/utils/export-scam.js +2 -1
- package/src/generators/utils/find-module.js +13 -18
- package/src/generators/utils/storybook-ast/component-info.js +24 -40
- package/src/generators/utils/storybook-ast/module-info.d.ts +1 -1
- package/src/generators/utils/storybook-ast/module-info.js +8 -3
- 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/plugins/plugin.js +13 -22
- package/src/utils/backward-compatible-versions.d.ts +2 -2
- package/src/utils/backward-compatible-versions.js +21 -20
- package/src/utils/nx-devkit/ast-utils.js +3 -17
- package/src/utils/nx-devkit/testing.js +9 -9
- package/src/utils/versions.d.ts +4 -3
- package/src/utils/versions.js +5 -4
- package/src/executors/utilities/builder-package.d.ts +0 -1
- package/src/executors/utilities/builder-package.js +0 -11
- package/src/generators/application/files/ng-module/src/app/app__componentFileSuffix__.spec.ts__tpl__ +0 -28
- package/src/generators/application/files/ng-module/src/app/app__moduleTypeSeparator__module.ts__tpl__ +0 -17
- package/src/generators/application/files/standalone-components/src/app/app__componentFileSuffix__.spec.ts__tpl__ +0 -27
- package/src/generators/setup-mf/files/host-files/__appFileName__.spec.ts__tmpl__ +0 -43
- package/src/generators/setup-ssr/files/v20+/application-builder/ngmodule-src/__main__ +0 -1
- package/src/generators/setup-ssr/files/v20+/application-builder/ngmodule-src/app/__rootModuleFileName__ +0 -12
- package/src/generators/setup-ssr/files/v20+/application-builder/ngmodule-src/app/app.routes.server.ts__tpl__ +0 -8
- package/src/generators/setup-ssr/files/v20+/application-builder/server/__serverFileName__ +0 -66
- package/src/generators/setup-ssr/files/v20+/application-builder/standalone-src/__main__ +0 -7
- package/src/generators/setup-ssr/files/v20+/application-builder/standalone-src/app/app.config.server.ts__tpl__ +0 -12
- package/src/generators/setup-ssr/files/v20+/application-builder/standalone-src/app/app.routes.server.ts__tpl__ +0 -8
- package/src/generators/setup-ssr/files/v20+/server-builder/ngmodule-src/__main__ +0 -1
- package/src/generators/setup-ssr/files/v20+/server-builder/ngmodule-src/app/__rootModuleFileName__ +0 -14
- package/src/generators/setup-ssr/files/v20+/server-builder/root/tsconfig.server.json.template +0 -16
- package/src/generators/setup-ssr/files/v20+/server-builder/server/__serverFileName__ +0 -69
- package/src/generators/setup-ssr/files/v20+/server-builder/standalone-src/__main__ +0 -7
- package/src/generators/setup-ssr/files/v20+/server-builder/standalone-src/app/app.config.server.ts.template +0 -11
- package/src/generators/utils/app-components-info.d.ts +0 -9
- package/src/generators/utils/app-components-info.js +0 -39
- package/src/generators/utils/artifact-types.d.ts +0 -3
- package/src/generators/utils/artifact-types.js +0 -33
- package/src/migrations/update-21-2-0/migrate-provide-server-rendering-import.d.ts +0 -2
- package/src/migrations/update-21-2-0/migrate-provide-server-rendering-import.js +0 -110
- package/src/migrations/update-21-2-0/replace-provide-server-routing.d.ts +0 -2
- package/src/migrations/update-21-2-0/replace-provide-server-routing.js +0 -103
- package/src/migrations/update-21-2-0/set-generator-defaults-for-previous-style-guide.d.ts +0 -2
- package/src/migrations/update-21-2-0/set-generator-defaults-for-previous-style-guide.js +0 -47
- package/src/migrations/update-21-2-0/update-angular-cli.d.ts +0 -3
- package/src/migrations/update-21-2-0/update-angular-cli.js +0 -23
- /package/src/generators/application/files/{base → base-18+}/public/favicon.ico +0 -0
- /package/src/generators/application/files/{ng-module/src/app/app__componentFileSuffix__.__style__ → base-pre18/src/assets/.gitkeep__tpl__} +0 -0
- /package/src/generators/application/files/{standalone-components/src/app/app__componentFileSuffix__.__style__ → ng-module/src/app/app.component.__style__} +0 -0
- /package/src/generators/application/files/ng-module/src/app/{app__componentFileSuffix__.html__tpl__ → app.component.html__tpl__} +0 -0
- /package/src/generators/application/files/standalone-components/src/app/{app__componentFileSuffix__.html__tpl__ → app.component.html__tpl__} +0 -0
- /package/src/generators/component/files/{__fileName____ngext__.html__tpl__ → __fileName__.html__tpl__} +0 -0
- /package/src/generators/library/files/ng-module/src/lib/{__libFileName____moduleTypeSeparator__module.ts__tpl__ → __libFileName__.module.ts__tpl__} +0 -0
- /package/src/generators/library-secondary-entry-point/files/src/lib/{__fileName____moduleTypeSeparator__module.ts__tmpl__ → __fileName__.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
|
@@ -2,117 +2,14 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.createProject = createProject;
|
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
|
5
|
-
const target_defaults_utils_1 = require("@nx/devkit/src/generators/target-defaults-utils");
|
|
6
5
|
const version_utils_1 = require("../../utils/version-utils");
|
|
6
|
+
const target_defaults_utils_1 = require("@nx/devkit/src/generators/target-defaults-utils");
|
|
7
7
|
function createProject(tree, options) {
|
|
8
|
-
let project;
|
|
9
|
-
if (options.bundler === 'esbuild') {
|
|
10
|
-
project = createProjectForEsbuild(tree, options);
|
|
11
|
-
}
|
|
12
|
-
else {
|
|
13
|
-
project = createProjectForWebpack(tree, options);
|
|
14
|
-
}
|
|
15
|
-
(0, devkit_1.addProjectConfiguration)(tree, options.name, project);
|
|
16
|
-
}
|
|
17
|
-
function createProjectForEsbuild(tree, options) {
|
|
18
8
|
const { major: angularMajorVersion } = (0, version_utils_1.getInstalledAngularVersionInfo)(tree);
|
|
19
|
-
const buildExecutor =
|
|
20
|
-
? '@angular/build:
|
|
9
|
+
const buildExecutor = options.bundler === 'webpack'
|
|
10
|
+
? '@angular-devkit/build-angular:browser'
|
|
21
11
|
: '@angular-devkit/build-angular:application';
|
|
22
|
-
|
|
23
|
-
let budgets = undefined;
|
|
24
|
-
if (options.strict) {
|
|
25
|
-
budgets = [
|
|
26
|
-
{ type: 'initial', maximumWarning: '500kb', maximumError: '1mb' },
|
|
27
|
-
{
|
|
28
|
-
type: 'anyComponentStyle',
|
|
29
|
-
maximumWarning: '4kb',
|
|
30
|
-
maximumError: '8kb',
|
|
31
|
-
},
|
|
32
|
-
];
|
|
33
|
-
}
|
|
34
|
-
else {
|
|
35
|
-
budgets = [
|
|
36
|
-
{ type: 'initial', maximumWarning: '2mb', maximumError: '5mb' },
|
|
37
|
-
{
|
|
38
|
-
type: 'anyComponentStyle',
|
|
39
|
-
maximumWarning: '6kb',
|
|
40
|
-
maximumError: '10kb',
|
|
41
|
-
},
|
|
42
|
-
];
|
|
43
|
-
}
|
|
44
|
-
const inlineStyleLanguage = options?.style !== 'css' ? options.style : undefined;
|
|
45
|
-
const project = {
|
|
46
|
-
name: options.name,
|
|
47
|
-
projectType: 'application',
|
|
48
|
-
prefix: options.prefix,
|
|
49
|
-
root: options.appProjectRoot,
|
|
50
|
-
sourceRoot: options.appProjectSourceRoot,
|
|
51
|
-
tags: options.parsedTags,
|
|
52
|
-
targets: {
|
|
53
|
-
build: {
|
|
54
|
-
executor: buildExecutor,
|
|
55
|
-
outputs: ['{options.outputPath}'],
|
|
56
|
-
options: {
|
|
57
|
-
outputPath: options.outputPath,
|
|
58
|
-
index: angularMajorVersion >= 20
|
|
59
|
-
? undefined
|
|
60
|
-
: `${options.appProjectSourceRoot}/index.html`,
|
|
61
|
-
browser: `${options.appProjectSourceRoot}/main.ts`,
|
|
62
|
-
polyfills: ['zone.js'],
|
|
63
|
-
tsConfig: (0, devkit_1.joinPathFragments)(options.appProjectRoot, 'tsconfig.app.json'),
|
|
64
|
-
inlineStyleLanguage,
|
|
65
|
-
assets: [
|
|
66
|
-
{
|
|
67
|
-
glob: '**/*',
|
|
68
|
-
input: (0, devkit_1.joinPathFragments)(options.appProjectRoot, 'public'),
|
|
69
|
-
},
|
|
70
|
-
],
|
|
71
|
-
styles: [`${options.appProjectSourceRoot}/styles.${options.style}`],
|
|
72
|
-
},
|
|
73
|
-
configurations: {
|
|
74
|
-
production: {
|
|
75
|
-
budgets,
|
|
76
|
-
outputHashing: 'all',
|
|
77
|
-
},
|
|
78
|
-
development: {
|
|
79
|
-
optimization: false,
|
|
80
|
-
extractLicenses: false,
|
|
81
|
-
sourceMap: true,
|
|
82
|
-
},
|
|
83
|
-
},
|
|
84
|
-
defaultConfiguration: 'production',
|
|
85
|
-
},
|
|
86
|
-
serve: {
|
|
87
|
-
continuous: true,
|
|
88
|
-
executor: angularMajorVersion >= 20
|
|
89
|
-
? '@angular/build:dev-server'
|
|
90
|
-
: '@angular-devkit/build-angular:dev-server',
|
|
91
|
-
options: options.port ? { port: options.port } : undefined,
|
|
92
|
-
configurations: {
|
|
93
|
-
production: {
|
|
94
|
-
buildTarget: `${options.name}:build:production`,
|
|
95
|
-
},
|
|
96
|
-
development: {
|
|
97
|
-
buildTarget: `${options.name}:build:development`,
|
|
98
|
-
},
|
|
99
|
-
},
|
|
100
|
-
defaultConfiguration: 'development',
|
|
101
|
-
},
|
|
102
|
-
'extract-i18n': {
|
|
103
|
-
executor: angularMajorVersion >= 20
|
|
104
|
-
? '@angular/build:extract-i18n'
|
|
105
|
-
: '@angular-devkit/build-angular:extract-i18n',
|
|
106
|
-
options: {
|
|
107
|
-
buildTarget: `${options.name}:build`,
|
|
108
|
-
},
|
|
109
|
-
},
|
|
110
|
-
},
|
|
111
|
-
};
|
|
112
|
-
return project;
|
|
113
|
-
}
|
|
114
|
-
function createProjectForWebpack(tree, options) {
|
|
115
|
-
const buildExecutor = '@angular-devkit/build-angular:browser';
|
|
12
|
+
const buildMainOptionName = options.bundler === 'esbuild' ? 'browser' : 'main';
|
|
116
13
|
(0, target_defaults_utils_1.addBuildTargetDefaults)(tree, buildExecutor);
|
|
117
14
|
let budgets = undefined;
|
|
118
15
|
if (options.strict) {
|
|
@@ -150,17 +47,23 @@ function createProjectForWebpack(tree, options) {
|
|
|
150
47
|
options: {
|
|
151
48
|
outputPath: options.outputPath,
|
|
152
49
|
index: `${options.appProjectSourceRoot}/index.html`,
|
|
153
|
-
|
|
50
|
+
[buildMainOptionName]: `${options.appProjectSourceRoot}/main.ts`,
|
|
154
51
|
polyfills: ['zone.js'],
|
|
155
52
|
tsConfig: (0, devkit_1.joinPathFragments)(options.appProjectRoot, 'tsconfig.app.json'),
|
|
156
53
|
inlineStyleLanguage,
|
|
157
|
-
assets:
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
54
|
+
assets: angularMajorVersion >= 18
|
|
55
|
+
? [
|
|
56
|
+
{
|
|
57
|
+
glob: '**/*',
|
|
58
|
+
input: (0, devkit_1.joinPathFragments)(options.appProjectRoot, 'public'),
|
|
59
|
+
},
|
|
60
|
+
]
|
|
61
|
+
: [
|
|
62
|
+
`${options.appProjectSourceRoot}/favicon.ico`,
|
|
63
|
+
`${options.appProjectSourceRoot}/assets`,
|
|
64
|
+
],
|
|
163
65
|
styles: [`${options.appProjectSourceRoot}/styles.${options.style}`],
|
|
66
|
+
scripts: [],
|
|
164
67
|
},
|
|
165
68
|
configurations: {
|
|
166
69
|
production: {
|
|
@@ -168,12 +71,12 @@ function createProjectForWebpack(tree, options) {
|
|
|
168
71
|
outputHashing: 'all',
|
|
169
72
|
},
|
|
170
73
|
development: {
|
|
171
|
-
buildOptimizer: false,
|
|
74
|
+
buildOptimizer: options.bundler === 'webpack' ? false : undefined,
|
|
172
75
|
optimization: false,
|
|
173
|
-
vendorChunk: true,
|
|
76
|
+
vendorChunk: options.bundler === 'webpack' ? true : undefined,
|
|
174
77
|
extractLicenses: false,
|
|
175
78
|
sourceMap: true,
|
|
176
|
-
namedChunks: true,
|
|
79
|
+
namedChunks: options.bundler === 'webpack' ? true : undefined,
|
|
177
80
|
},
|
|
178
81
|
},
|
|
179
82
|
defaultConfiguration: 'production',
|
|
@@ -181,7 +84,11 @@ function createProjectForWebpack(tree, options) {
|
|
|
181
84
|
serve: {
|
|
182
85
|
continuous: true,
|
|
183
86
|
executor: '@angular-devkit/build-angular:dev-server',
|
|
184
|
-
options: options.port
|
|
87
|
+
options: options.port
|
|
88
|
+
? {
|
|
89
|
+
port: options.port,
|
|
90
|
+
}
|
|
91
|
+
: undefined,
|
|
185
92
|
configurations: {
|
|
186
93
|
production: {
|
|
187
94
|
buildTarget: `${options.name}:build:production`,
|
|
@@ -200,5 +107,5 @@ function createProjectForWebpack(tree, options) {
|
|
|
200
107
|
},
|
|
201
108
|
},
|
|
202
109
|
};
|
|
203
|
-
|
|
110
|
+
(0, devkit_1.addProjectConfiguration)(tree, options.name, project);
|
|
204
111
|
}
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.enableStrictTypeChecking = enableStrictTypeChecking;
|
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
|
5
|
-
const version_utils_1 = require("../../utils/version-utils");
|
|
6
5
|
function enableStrictTypeChecking(host, options) {
|
|
7
6
|
// This matches the settings defined by the Angular CLI https://angular.io/guide/strict-mode
|
|
8
7
|
const compilerOptions = {
|
|
@@ -15,14 +14,12 @@ function enableStrictTypeChecking(host, options) {
|
|
|
15
14
|
};
|
|
16
15
|
const appTsConfigPath = `${options.appProjectRoot}/tsconfig.json`;
|
|
17
16
|
if (host.exists(appTsConfigPath)) {
|
|
18
|
-
const { major: angularMajorVersion } = (0, version_utils_1.getInstalledAngularVersionInfo)(host);
|
|
19
17
|
(0, devkit_1.updateJson)(host, appTsConfigPath, (json) => {
|
|
20
18
|
json.compilerOptions = { ...json.compilerOptions, ...compilerOptions };
|
|
21
19
|
json.angularCompilerOptions = {
|
|
22
20
|
enableI18nLegacyMessageIdFormat: false,
|
|
23
21
|
strictInjectionParameters: true,
|
|
24
22
|
strictInputAccessModifiers: true,
|
|
25
|
-
typeCheckHostBindings: angularMajorVersion >= 20 ? true : undefined,
|
|
26
23
|
strictTemplates: true,
|
|
27
24
|
};
|
|
28
25
|
return json;
|
|
@@ -177,7 +177,7 @@
|
|
|
177
177
|
"default": false
|
|
178
178
|
},
|
|
179
179
|
"serverRouting": {
|
|
180
|
-
"description": "Creates a server application using the Server Routing and App Engine APIs
|
|
180
|
+
"description": "Creates a server application using the Server Routing and App Engine APIs (Developer Preview). _Note: this is only supported in Angular versions >= 19.0.0_.",
|
|
181
181
|
"type": "boolean"
|
|
182
182
|
}
|
|
183
183
|
},
|
|
@@ -22,11 +22,10 @@ async function componentGenerator(tree, rawOptions) {
|
|
|
22
22
|
viewEncapsulation: options.viewEncapsulation,
|
|
23
23
|
displayBlock: options.displayBlock,
|
|
24
24
|
selector: options.selector,
|
|
25
|
-
// Angular v19 or higher defaults to true, while lower
|
|
25
|
+
// Angular v19 or higher defaults to true, while v18 or lower defaults to false
|
|
26
26
|
setStandalone: (angularMajorVersion >= 19 && !options.standalone) ||
|
|
27
27
|
(angularMajorVersion < 19 && options.standalone),
|
|
28
28
|
angularMajorVersion,
|
|
29
|
-
ngext: options.ngHtml ? '.ng' : '',
|
|
30
29
|
tpl: '',
|
|
31
30
|
});
|
|
32
31
|
if (options.skipTests) {
|
|
@@ -42,17 +41,7 @@ async function componentGenerator(tree, rawOptions) {
|
|
|
42
41
|
tree.delete(pathToStyleFile);
|
|
43
42
|
}
|
|
44
43
|
if (!options.skipImport && !options.standalone) {
|
|
45
|
-
|
|
46
|
-
try {
|
|
47
|
-
modulePath = (0, lib_1.findModuleFromOptions)(tree, options, options.projectRoot);
|
|
48
|
-
}
|
|
49
|
-
catch (e) {
|
|
50
|
-
modulePath = (0, lib_1.findModuleFromOptions)(tree, {
|
|
51
|
-
...options,
|
|
52
|
-
moduleExt: '-module.ts',
|
|
53
|
-
routingModuleExt: '-routing-module.ts',
|
|
54
|
-
}, options.projectRoot);
|
|
55
|
-
}
|
|
44
|
+
const modulePath = (0, lib_1.findModuleFromOptions)(tree, options, options.projectRoot);
|
|
56
45
|
(0, utils_1.addToNgModule)(tree, options.directory, modulePath, options.name, options.symbolName, options.fileName, 'declarations', true, options.export);
|
|
57
46
|
}
|
|
58
47
|
(0, lib_1.exportComponentInEntryPoint)(tree, options);
|
|
@@ -6,7 +6,7 @@ import { CommonModule } from '@angular/common';<% } %>
|
|
|
6
6
|
standalone: <%= standalone %>,<% } %><% if(standalone) { %>
|
|
7
7
|
imports: [CommonModule],<%}%><% if(inlineTemplate) { %>
|
|
8
8
|
template: `<p><%= name %> works!</p>`<% } else { %>
|
|
9
|
-
templateUrl: './<%= fileName
|
|
9
|
+
templateUrl: './<%= fileName %>.html'<% } if(inlineStyle) { %>,
|
|
10
10
|
styles: `<% if(displayBlock){ %>
|
|
11
11
|
:host {
|
|
12
12
|
display: block;
|
|
@@ -21,17 +21,7 @@ function exportComponentInEntryPoint(tree, schema) {
|
|
|
21
21
|
return;
|
|
22
22
|
}
|
|
23
23
|
if (!schema.standalone) {
|
|
24
|
-
|
|
25
|
-
try {
|
|
26
|
-
modulePath = (0, module_1.findModuleFromOptions)(tree, schema, root);
|
|
27
|
-
}
|
|
28
|
-
catch (e) {
|
|
29
|
-
modulePath = (0, module_1.findModuleFromOptions)(tree, {
|
|
30
|
-
...schema,
|
|
31
|
-
moduleExt: '-module.ts',
|
|
32
|
-
routingModuleExt: '-routing-module.ts',
|
|
33
|
-
}, root);
|
|
34
|
-
}
|
|
24
|
+
const modulePath = (0, module_1.findModuleFromOptions)(tree, schema, root);
|
|
35
25
|
if (!shouldExportInEntryPoint(tree, entryPointPath, modulePath)) {
|
|
36
26
|
return;
|
|
37
27
|
}
|
|
@@ -1,8 +1,3 @@
|
|
|
1
1
|
import type { Tree } from '@nx/devkit';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
module?: string;
|
|
5
|
-
moduleExt?: string;
|
|
6
|
-
routingModuleExt?: string;
|
|
7
|
-
};
|
|
8
|
-
export declare function findModuleFromOptions(tree: Tree, options: ModuleOptions, projectRoot: string): string;
|
|
2
|
+
import type { NormalizedSchema } from '../schema';
|
|
3
|
+
export declare function findModuleFromOptions(tree: Tree, options: NormalizedSchema, projectRoot: string): string;
|
|
@@ -5,13 +5,11 @@ const devkit_1 = require("@nx/devkit");
|
|
|
5
5
|
const path_1 = require("path");
|
|
6
6
|
// Adapted from https://github.com/angular/angular-cli/blob/732aab5fa7e63618c89dfbbb6f78753f706d7014/packages/schematics/angular/utility/find-module.ts#L29
|
|
7
7
|
// to match the logic from the Angular CLI component schematic.
|
|
8
|
-
const
|
|
9
|
-
const
|
|
8
|
+
const moduleExt = '.module.ts';
|
|
9
|
+
const routingModuleExt = '-routing.module.ts';
|
|
10
10
|
function findModuleFromOptions(tree, options, projectRoot) {
|
|
11
|
-
const moduleExt = options.moduleExt || MODULE_EXT;
|
|
12
|
-
const routingModuleExt = options.routingModuleExt || ROUTING_MODULE_EXT;
|
|
13
11
|
if (!options.module) {
|
|
14
|
-
return (0, devkit_1.normalizePath)(findModule(tree, options.directory, projectRoot
|
|
12
|
+
return (0, devkit_1.normalizePath)(findModule(tree, options.directory, projectRoot));
|
|
15
13
|
}
|
|
16
14
|
else {
|
|
17
15
|
const modulePath = (0, devkit_1.joinPathFragments)(options.directory, options.module);
|
|
@@ -34,7 +32,7 @@ function findModuleFromOptions(tree, options, projectRoot) {
|
|
|
34
32
|
`${moduleBaseName}${moduleExt}`,
|
|
35
33
|
].map((x) => (0, devkit_1.joinPathFragments)(c, x));
|
|
36
34
|
for (const sc of candidateFiles) {
|
|
37
|
-
if (tree.isFile(sc)
|
|
35
|
+
if (tree.isFile(sc)) {
|
|
38
36
|
return (0, devkit_1.normalizePath)(sc);
|
|
39
37
|
}
|
|
40
38
|
}
|
|
@@ -43,7 +41,7 @@ function findModuleFromOptions(tree, options, projectRoot) {
|
|
|
43
41
|
`Looked in the following directories:\n ${candidatesDirs.join('\n ')}`);
|
|
44
42
|
}
|
|
45
43
|
}
|
|
46
|
-
function findModule(tree, generateDir, projectRoot
|
|
44
|
+
function findModule(tree, generateDir, projectRoot) {
|
|
47
45
|
let dir = generateDir;
|
|
48
46
|
const projectRootParent = (0, path_1.dirname)(projectRoot);
|
|
49
47
|
while (dir !== projectRootParent) {
|
|
@@ -5,16 +5,12 @@ const devkit_1 = require("@nx/devkit");
|
|
|
5
5
|
const artifact_name_and_directory_utils_1 = require("@nx/devkit/src/generators/artifact-name-and-directory-utils");
|
|
6
6
|
const selector_1 = require("../../utils/selector");
|
|
7
7
|
const validations_1 = require("../../utils/validations");
|
|
8
|
-
const version_utils_1 = require("../../utils/version-utils");
|
|
9
8
|
async function normalizeOptions(tree, options) {
|
|
10
|
-
|
|
11
|
-
if (angularMajorVersion < 20) {
|
|
12
|
-
options.type ??= 'component';
|
|
13
|
-
}
|
|
9
|
+
options.type ??= 'component';
|
|
14
10
|
const { artifactName: name, directory, fileName, filePath, project: projectName, } = await (0, artifact_name_and_directory_utils_1.determineArtifactNameAndDirectoryOptions)(tree, {
|
|
15
11
|
name: options.name,
|
|
16
12
|
path: options.path,
|
|
17
|
-
suffix: options.type,
|
|
13
|
+
suffix: options.type ?? 'component',
|
|
18
14
|
allowedFileExtensions: ['ts'],
|
|
19
15
|
fileExtension: 'ts',
|
|
20
16
|
});
|
|
@@ -22,7 +18,7 @@ async function normalizeOptions(tree, options) {
|
|
|
22
18
|
throw new Error(`The component name '${name}' cannot contain a slash as it must be a valid JS symbol. Please use a different name.`);
|
|
23
19
|
}
|
|
24
20
|
const { className } = (0, devkit_1.names)(name);
|
|
25
|
-
const suffixClassName =
|
|
21
|
+
const { className: suffixClassName } = (0, devkit_1.names)(options.type);
|
|
26
22
|
const symbolName = `${className}${suffixClassName}`;
|
|
27
23
|
(0, validations_1.validateClassName)(symbolName);
|
|
28
24
|
const { prefix, root, sourceRoot } = (0, devkit_1.readProjectConfiguration)(tree, projectName);
|
|
@@ -95,7 +95,8 @@
|
|
|
95
95
|
},
|
|
96
96
|
"type": {
|
|
97
97
|
"type": "string",
|
|
98
|
-
"description": "
|
|
98
|
+
"description": "Adds a developer-defined type to the filename, in the format `name.type.ts`.",
|
|
99
|
+
"default": "component"
|
|
99
100
|
},
|
|
100
101
|
"export": {
|
|
101
102
|
"type": "boolean",
|
|
@@ -108,11 +109,6 @@
|
|
|
108
109
|
"default": false,
|
|
109
110
|
"description": "Use default export for the component instead of a named export."
|
|
110
111
|
},
|
|
111
|
-
"ngHtml": {
|
|
112
|
-
"type": "boolean",
|
|
113
|
-
"default": false,
|
|
114
|
-
"description": "Generate component template files with an '.ng.html' file extension instead of '.html'."
|
|
115
|
-
},
|
|
116
112
|
"skipFormat": {
|
|
117
113
|
"description": "Skip formatting files.",
|
|
118
114
|
"type": "boolean",
|
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.convertToApplicationExecutor = convertToApplicationExecutor;
|
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
|
5
5
|
const posix_1 = require("node:path/posix");
|
|
6
|
+
const semver_1 = require("semver");
|
|
6
7
|
const targets_1 = require("../../utils/targets");
|
|
7
8
|
const setup_ssr_1 = require("../setup-ssr/setup-ssr");
|
|
8
9
|
const validations_1 = require("../utils/validations");
|
|
@@ -25,16 +26,17 @@ const redundantExecutors = new Set([
|
|
|
25
26
|
'@nx/angular:webpack-server',
|
|
26
27
|
]);
|
|
27
28
|
async function convertToApplicationExecutor(tree, options) {
|
|
29
|
+
const { version: angularVersion } = (0, version_utils_1.getInstalledAngularVersionInfo)(tree);
|
|
28
30
|
let didAnySucceed = false;
|
|
29
31
|
if (options.project) {
|
|
30
32
|
(0, validations_1.validateProject)(tree, options.project);
|
|
31
|
-
didAnySucceed = await convertProjectTargets(tree, options.project, true);
|
|
33
|
+
didAnySucceed = await convertProjectTargets(tree, options.project, angularVersion, true);
|
|
32
34
|
}
|
|
33
35
|
else {
|
|
34
36
|
const projects = (0, devkit_1.getProjects)(tree);
|
|
35
37
|
for (const [projectName] of projects) {
|
|
36
38
|
devkit_1.logger.info(`Converting project "${projectName}"...`);
|
|
37
|
-
const success = await convertProjectTargets(tree, projectName);
|
|
39
|
+
const success = await convertProjectTargets(tree, projectName, angularVersion);
|
|
38
40
|
if (success) {
|
|
39
41
|
devkit_1.logger.info(`Project "${projectName}" converted successfully.`);
|
|
40
42
|
}
|
|
@@ -50,7 +52,7 @@ async function convertToApplicationExecutor(tree, options) {
|
|
|
50
52
|
}
|
|
51
53
|
return didAnySucceed ? () => (0, devkit_1.installPackagesTask)(tree) : () => { };
|
|
52
54
|
}
|
|
53
|
-
async function convertProjectTargets(tree, projectName, isProvidedProject = false) {
|
|
55
|
+
async function convertProjectTargets(tree, projectName, angularVersion, isProvidedProject = false) {
|
|
54
56
|
function warnIfProvided(message) {
|
|
55
57
|
if (isProvidedProject) {
|
|
56
58
|
devkit_1.logger.warn(message);
|
|
@@ -61,7 +63,7 @@ async function convertProjectTargets(tree, projectName, isProvidedProject = fals
|
|
|
61
63
|
warnIfProvided(`The provided project "${projectName}" is not an application. Skipping conversion.`);
|
|
62
64
|
return false;
|
|
63
65
|
}
|
|
64
|
-
const { buildTargetName, serverTargetName } = getTargetsToConvert(project.targets);
|
|
66
|
+
const { buildTargetName, serverTargetName } = getTargetsToConvert(project.targets, angularVersion);
|
|
65
67
|
if (!buildTargetName) {
|
|
66
68
|
warnIfProvided(`The provided project "${projectName}" does not have any targets using on of the ` +
|
|
67
69
|
`'@angular-devkit/build-angular:browser', '@angular-devkit/build-angular:browser-esbuild', ` +
|
|
@@ -69,20 +71,12 @@ async function convertProjectTargets(tree, projectName, isProvidedProject = fals
|
|
|
69
71
|
return false;
|
|
70
72
|
}
|
|
71
73
|
const useNxExecutor = project.targets[buildTargetName].executor.startsWith('@nx/angular:');
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
}
|
|
76
|
-
else {
|
|
77
|
-
const { major: angularMajorVersion } = (0, version_utils_1.getInstalledAngularVersionInfo)(tree);
|
|
78
|
-
newExecutor =
|
|
79
|
-
angularMajorVersion >= 20
|
|
80
|
-
? '@angular/build:application'
|
|
81
|
-
: '@angular-devkit/build-angular:application';
|
|
82
|
-
}
|
|
74
|
+
const newExecutor = useNxExecutor
|
|
75
|
+
? '@nx/angular:application'
|
|
76
|
+
: '@angular-devkit/build-angular:application';
|
|
83
77
|
const buildTarget = project.targets[buildTargetName];
|
|
84
78
|
buildTarget.executor = newExecutor;
|
|
85
|
-
if (buildTarget.outputs) {
|
|
79
|
+
if ((0, semver_1.gte)(angularVersion, '17.1.0') && buildTarget.outputs) {
|
|
86
80
|
buildTarget.outputs = buildTarget.outputs.map((output) => output === '{options.outputPath}' ? '{options.outputPath.base}' : output);
|
|
87
81
|
}
|
|
88
82
|
for (const [, options] of (0, targets_1.allTargetOptions)(buildTarget)) {
|
|
@@ -100,7 +94,10 @@ async function convertProjectTargets(tree, projectName, isProvidedProject = fals
|
|
|
100
94
|
options['polyfills'] = [options['polyfills']];
|
|
101
95
|
}
|
|
102
96
|
let outputPath = options['outputPath'];
|
|
103
|
-
if (
|
|
97
|
+
if ((0, semver_1.lt)(angularVersion, '17.1.0')) {
|
|
98
|
+
options['outputPath'] = outputPath?.replace(/\/browser\/?$/, '');
|
|
99
|
+
}
|
|
100
|
+
else if (typeof outputPath === 'string') {
|
|
104
101
|
if (!/\/browser\/?$/.test(outputPath)) {
|
|
105
102
|
devkit_1.logger.warn(`The output location of the browser build has been updated from "${outputPath}" to ` +
|
|
106
103
|
`"${(0, posix_1.join)(outputPath, 'browser')}". ` +
|
|
@@ -124,6 +121,9 @@ async function convertProjectTargets(tree, projectName, isProvidedProject = fals
|
|
|
124
121
|
}
|
|
125
122
|
}
|
|
126
123
|
// Delete removed options
|
|
124
|
+
if ((0, semver_1.lt)(angularVersion, '17.3.0')) {
|
|
125
|
+
delete options['deployUrl'];
|
|
126
|
+
}
|
|
127
127
|
delete options['vendorChunk'];
|
|
128
128
|
delete options['commonChunk'];
|
|
129
129
|
delete options['resourcesOutputPath'];
|
|
@@ -189,12 +189,11 @@ async function convertProjectTargets(tree, projectName, isProvidedProject = fals
|
|
|
189
189
|
(0, devkit_1.updateProjectConfiguration)(tree, projectName, project);
|
|
190
190
|
return true;
|
|
191
191
|
}
|
|
192
|
-
function getTargetsToConvert(targets) {
|
|
192
|
+
function getTargetsToConvert(targets, angularVersion) {
|
|
193
193
|
let buildTargetName;
|
|
194
194
|
let serverTargetName;
|
|
195
195
|
for (const target of Object.keys(targets)) {
|
|
196
196
|
if (targets[target].executor === '@nx/angular:application' ||
|
|
197
|
-
targets[target].executor === '@angular/build:application' ||
|
|
198
197
|
targets[target].executor === '@angular-devkit/build-angular:application') {
|
|
199
198
|
devkit_1.logger.warn('The project is already using the application builder. Skipping conversion.');
|
|
200
199
|
return {};
|
|
@@ -202,6 +201,10 @@ function getTargetsToConvert(targets) {
|
|
|
202
201
|
// build target
|
|
203
202
|
if (executorsToConvert.has(targets[target].executor)) {
|
|
204
203
|
for (const [, options] of (0, targets_1.allTargetOptions)(targets[target])) {
|
|
204
|
+
if ((0, semver_1.lt)(angularVersion, '17.3.0') && options.deployUrl) {
|
|
205
|
+
devkit_1.logger.warn(`The project is using the "deployUrl" option which is not available in the application builder. Skipping conversion.`);
|
|
206
|
+
return {};
|
|
207
|
+
}
|
|
205
208
|
if (options.customWebpackConfig) {
|
|
206
209
|
devkit_1.logger.warn(`The project is using a custom webpack configuration which is not supported by the esbuild-based application executor. Skipping conversion.`);
|
|
207
210
|
return {};
|
|
@@ -27,12 +27,7 @@ const RENAMED_OPTIONS = {
|
|
|
27
27
|
ngswConfigPath: 'serviceWorker',
|
|
28
28
|
};
|
|
29
29
|
const DEFAULT_PORT = 4200;
|
|
30
|
-
const REMOVED_OPTIONS = [
|
|
31
|
-
'buildOptimizer',
|
|
32
|
-
'buildTarget',
|
|
33
|
-
'browserTarget',
|
|
34
|
-
'publicHost',
|
|
35
|
-
];
|
|
30
|
+
const REMOVED_OPTIONS = ['buildOptimizer', 'buildTarget', 'browserTarget'];
|
|
36
31
|
function normalizeFromProjectRoot(tree, path, projectRoot) {
|
|
37
32
|
if (projectRoot === '.') {
|
|
38
33
|
if (!path.startsWith('./')) {
|
|
@@ -349,6 +344,7 @@ async function convertToRspack(tree, schema) {
|
|
|
349
344
|
if (!schema.skipInstall) {
|
|
350
345
|
const installTask = (0, devkit_1.addDependenciesToPackageJson)(tree, {}, {
|
|
351
346
|
'@nx/angular-rspack': versions_1.angularRspackVersion,
|
|
347
|
+
'webpack-merge': versions_1.webpackMergeVersion,
|
|
352
348
|
'ts-node': versions_1.tsNodeVersion,
|
|
353
349
|
});
|
|
354
350
|
tasks.push(installTask);
|
|
@@ -30,7 +30,7 @@ function convertWebpackConfigToUseNxModuleFederationPlugin(webpackConfigContents
|
|
|
30
30
|
const withModuleFederationImportNodes = (0, tsquery_1.tsquery)(ast, 'ImportDeclaration:has(StringLiteral[value=@nx/module-federation/angular])');
|
|
31
31
|
if (withModuleFederationImportNodes.length > 0) {
|
|
32
32
|
const withModuleFederationImportNode = withModuleFederationImportNodes[0];
|
|
33
|
-
newWebpackConfigContents = `${webpackConfigContents.slice(0, withModuleFederationImportNode.getStart())}import { NxModuleFederationPlugin, NxModuleFederationDevServerPlugin } from '@nx/module-federation/
|
|
33
|
+
newWebpackConfigContents = `${webpackConfigContents.slice(0, withModuleFederationImportNode.getStart())}import { NxModuleFederationPlugin, NxModuleFederationDevServerPlugin } from '@nx/module-federation/angular';${webpackConfigContents.slice(withModuleFederationImportNode.getEnd())}`;
|
|
34
34
|
ast = tsquery_1.tsquery.ast(newWebpackConfigContents);
|
|
35
35
|
const exportedWithModuleFederationNodes = (0, tsquery_1.tsquery)(ast, 'ExportAssignment:has(CallExpression > Identifier[name=withModuleFederation])');
|
|
36
36
|
if (exportedWithModuleFederationNodes.length > 0) {
|
|
@@ -13,7 +13,7 @@ async function directiveGenerator(tree, schema) {
|
|
|
13
13
|
symbolName: options.symbolName,
|
|
14
14
|
fileName: options.fileName,
|
|
15
15
|
standalone: options.standalone,
|
|
16
|
-
// Angular v19 or higher defaults to true, while lower
|
|
16
|
+
// Angular v19 or higher defaults to true, while v18 or lower defaults to false
|
|
17
17
|
setStandalone: (angularMajorVersion >= 19 && !options.standalone) ||
|
|
18
18
|
(angularMajorVersion < 19 && options.standalone),
|
|
19
19
|
tpl: '',
|
|
@@ -5,21 +5,16 @@ const devkit_1 = require("@nx/devkit");
|
|
|
5
5
|
const artifact_name_and_directory_utils_1 = require("@nx/devkit/src/generators/artifact-name-and-directory-utils");
|
|
6
6
|
const selector_1 = require("../../utils/selector");
|
|
7
7
|
const validations_1 = require("../../utils/validations");
|
|
8
|
-
const version_utils_1 = require("../../utils/version-utils");
|
|
9
8
|
async function normalizeOptions(tree, options) {
|
|
10
|
-
const { major: angularMajorVersion } = (0, version_utils_1.getInstalledAngularVersionInfo)(tree);
|
|
11
|
-
if (angularMajorVersion < 20) {
|
|
12
|
-
options.type ??= 'directive';
|
|
13
|
-
}
|
|
14
9
|
const { artifactName: name, directory, fileName, filePath, project: projectName, } = await (0, artifact_name_and_directory_utils_1.determineArtifactNameAndDirectoryOptions)(tree, {
|
|
15
10
|
name: options.name,
|
|
16
11
|
path: options.path,
|
|
17
|
-
suffix:
|
|
12
|
+
suffix: 'directive',
|
|
18
13
|
allowedFileExtensions: ['ts'],
|
|
19
14
|
fileExtension: 'ts',
|
|
20
15
|
});
|
|
21
16
|
const { className } = (0, devkit_1.names)(name);
|
|
22
|
-
const suffixClassName =
|
|
17
|
+
const { className: suffixClassName } = (0, devkit_1.names)('directive');
|
|
23
18
|
const symbolName = `${className}${suffixClassName}`;
|
|
24
19
|
(0, validations_1.validateClassName)(symbolName);
|
|
25
20
|
const { prefix } = (0, devkit_1.readProjectConfiguration)(tree, projectName);
|
|
@@ -12,15 +12,11 @@
|
|
|
12
12
|
"command": "nx g @nx/angular:directive mylib/src/lib/foo.directive.ts"
|
|
13
13
|
},
|
|
14
14
|
{
|
|
15
|
-
"description": "Generate a directive without providing the file extension. It results in the directive `
|
|
15
|
+
"description": "Generate a directive without providing the file extension. It results in the directive `FooDirective` at `mylib/src/lib/foo.directive.ts`",
|
|
16
16
|
"command": "nx g @nx/angular:directive mylib/src/lib/foo"
|
|
17
17
|
},
|
|
18
18
|
{
|
|
19
|
-
"description": "Generate a directive with
|
|
20
|
-
"command": "nx g @nx/angular:directive mylib/src/lib/foo --type=directive"
|
|
21
|
-
},
|
|
22
|
-
{
|
|
23
|
-
"description": "Generate a directive with the exported symbol different from the file name. It results in the directive `Custom` at `mylib/src/lib/foo.ts`",
|
|
19
|
+
"description": "Generate a directive with the exported symbol different from the file name. It results in the directive `CustomDirective` at `mylib/src/lib/foo.directive.ts`",
|
|
24
20
|
"command": "nx g @nx/angular:directive mylib/src/lib/foo --name=custom"
|
|
25
21
|
}
|
|
26
22
|
],
|
|
@@ -82,10 +78,6 @@
|
|
|
82
78
|
"default": false,
|
|
83
79
|
"description": "The declaring NgModule exports this directive."
|
|
84
80
|
},
|
|
85
|
-
"type": {
|
|
86
|
-
"type": "string",
|
|
87
|
-
"description": "Append a custom type to the directive's filename. It defaults to 'directive' for Angular versions below v20. For Angular v20 and above, no type is appended unless specified."
|
|
88
|
-
},
|
|
89
81
|
"skipFormat": {
|
|
90
82
|
"type": "boolean",
|
|
91
83
|
"default": false,
|