@nx/angular 22.2.2 → 22.3.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/executors.json +5 -0
- package/migrations.json +200 -291
- package/package.json +18 -18
- package/src/builders/dev-server/lib/normalize-options.d.ts.map +1 -1
- package/src/builders/dev-server/lib/normalize-options.js +1 -3
- package/src/builders/dev-server/lib/validate-options.d.ts.map +1 -1
- package/src/builders/dev-server/lib/validate-options.js +6 -5
- package/src/builders/dev-server/schema.d.ts +1 -0
- package/src/builders/dev-server/schema.json +9 -2
- package/src/executors/application/application.impl.js +1 -1
- package/src/executors/application/schema.json +11 -9
- package/src/executors/application/utils/normalize-options.d.ts.map +1 -1
- package/src/executors/application/utils/normalize-options.js +1 -27
- package/src/executors/application/utils/validate-options.d.ts.map +1 -1
- package/src/executors/application/utils/validate-options.js +0 -17
- package/src/executors/browser-esbuild/browser-esbuild.impl.js +1 -1
- package/src/executors/extract-i18n/extract-i18n.impl.js +1 -1
- package/src/executors/unit-test/schema.d.ts +7 -0
- package/src/executors/unit-test/schema.json +320 -0
- package/src/executors/unit-test/unit-test.impl.d.ts +5 -0
- package/src/executors/unit-test/unit-test.impl.d.ts.map +1 -0
- package/src/executors/unit-test/unit-test.impl.js +111 -0
- package/src/executors/utilities/ng-packagr/stylesheet-processor.d.ts.map +1 -0
- package/src/executors/utilities/ng-packagr/stylesheet-processor.di.d.ts.map +1 -1
- package/src/executors/utilities/ng-packagr/stylesheet-processor.di.js +2 -6
- package/src/executors/utilities/ng-packagr/{v19+/stylesheet-processor.js → stylesheet-processor.js} +2 -2
- package/src/generators/application/application.d.ts +1 -1
- package/src/generators/application/application.d.ts.map +1 -1
- package/src/generators/application/application.js +6 -1
- package/src/generators/application/files/base/tsconfig.app.json__tpl__ +2 -4
- package/src/generators/application/files/ng-module/src/app/app__componentFileSuffix__.spec.ts__tpl__ +2 -2
- package/src/generators/application/files/ng-module/src/app/app__componentFileSuffix__.ts__tpl__ +2 -2
- package/src/generators/application/files/ng-module/src/main.ts__tpl__ +1 -3
- package/src/generators/application/files/nx-welcome/claimed/ng-module/src/app/nx-welcome__componentFileSuffix__.ts__tpl__ +2 -2
- package/src/generators/application/files/nx-welcome/claimed/standalone/src/app/nx-welcome__componentFileSuffix__.ts__tpl__ +1 -2
- package/src/generators/application/files/nx-welcome/not-configured/ng-module/src/app/nx-welcome__componentFileSuffix__.ts__tpl__ +2 -2
- package/src/generators/application/files/nx-welcome/not-configured/standalone/src/app/nx-welcome__componentFileSuffix__.ts__tpl__ +1 -2
- package/src/generators/application/files/nx-welcome/unclaimed/ng-module/src/app/nx-welcome__componentFileSuffix__.ts__tpl__ +2 -2
- package/src/generators/application/files/nx-welcome/unclaimed/standalone/src/app/nx-welcome__componentFileSuffix__.ts__tpl__ +1 -2
- package/src/generators/application/files/rspack-ssr/server.ts__tmpl__ +6 -0
- package/src/generators/application/files/standalone-components/src/app/app.config.ts__tpl__ +3 -3
- package/src/generators/application/files/standalone-components/src/app/app__componentFileSuffix__.spec.ts__tpl__ +2 -2
- package/src/generators/application/files/standalone-components/src/app/app__componentFileSuffix__.ts__tpl__ +1 -2
- package/src/generators/application/lib/add-unit-test-runner.d.ts +1 -1
- package/src/generators/application/lib/add-unit-test-runner.d.ts.map +1 -1
- package/src/generators/application/lib/add-unit-test-runner.js +13 -2
- package/src/generators/application/lib/create-files.d.ts.map +1 -1
- package/src/generators/application/lib/create-files.js +1 -3
- package/src/generators/application/lib/create-project.js +12 -10
- package/src/generators/application/lib/enable-strict-type-checking.js +1 -1
- package/src/generators/application/lib/index.d.ts +2 -1
- package/src/generators/application/lib/index.d.ts.map +1 -1
- package/src/generators/application/lib/index.js +2 -1
- package/src/generators/application/lib/normalize-options.d.ts.map +1 -1
- package/src/generators/application/lib/normalize-options.js +12 -2
- package/src/generators/application/lib/update-tsconfig-files.d.ts.map +1 -1
- package/src/generators/application/lib/update-tsconfig-files.js +6 -17
- package/src/generators/application/lib/validate-options.d.ts +4 -0
- package/src/generators/application/lib/validate-options.d.ts.map +1 -0
- package/src/generators/application/lib/validate-options.js +26 -0
- package/src/generators/application/schema.d.ts +1 -0
- package/src/generators/application/schema.json +7 -4
- package/src/generators/component/component.d.ts.map +1 -1
- package/src/generators/component/component.js +4 -3
- package/src/generators/component/files/__fileName__.spec.ts__tpl__ +1 -1
- package/src/generators/component/files/__fileName__.ts__tpl__ +1 -1
- package/src/generators/component-test/component-test.d.ts +3 -3
- package/src/generators/component-test/component-test.d.ts.map +1 -1
- package/src/generators/component-test/component-test.js +9 -0
- package/src/generators/component-test/schema.d.ts +1 -0
- package/src/generators/component-test/schema.json +6 -0
- package/src/generators/convert-to-rspack/convert-to-rspack.d.ts.map +1 -1
- package/src/generators/convert-to-rspack/convert-to-rspack.js +1 -4
- package/src/generators/cypress-component-configuration/cypress-component-configuration.d.ts.map +1 -1
- package/src/generators/cypress-component-configuration/cypress-component-configuration.js +80 -33
- package/src/generators/cypress-component-configuration/schema.d.ts +1 -0
- package/src/generators/cypress-component-configuration/schema.json +6 -0
- package/src/generators/directive/directive.d.ts.map +1 -1
- package/src/generators/directive/directive.js +0 -3
- package/src/generators/directive/files/__fileName__.ts__tpl__ +1 -1
- package/src/generators/federate-module/federate-module.d.ts +1 -1
- package/src/generators/federate-module/federate-module.d.ts.map +1 -1
- package/src/generators/federate-module/federate-module.js +8 -0
- package/src/generators/federate-module/lib/add-remote.js +1 -1
- package/src/generators/federate-module/schema.d.ts +2 -2
- package/src/generators/federate-module/schema.json +3 -4
- package/src/generators/host/files/common/src/main.server.ts__tmpl__ +8 -1
- package/src/generators/host/host.d.ts.map +1 -1
- package/src/generators/host/host.js +5 -1
- package/src/generators/host/lib/index.d.ts +1 -0
- package/src/generators/host/lib/index.d.ts.map +1 -1
- package/src/generators/host/lib/index.js +1 -0
- package/src/generators/host/lib/update-ssr-setup.d.ts.map +1 -1
- package/src/generators/host/lib/update-ssr-setup.js +6 -4
- package/src/generators/host/lib/validate-options.d.ts +4 -0
- package/src/generators/host/lib/validate-options.d.ts.map +1 -0
- package/src/generators/host/lib/validate-options.js +12 -0
- package/src/generators/host/schema.d.ts +2 -2
- package/src/generators/host/schema.json +5 -6
- package/src/generators/library/files/base/tsconfig.lib.json__tpl__ +3 -5
- package/src/generators/library/lib/normalize-options.d.ts.map +1 -1
- package/src/generators/library/lib/normalize-options.js +10 -3
- package/src/generators/library/lib/update-tsconfig-files.d.ts.map +1 -1
- package/src/generators/library/lib/update-tsconfig-files.js +15 -6
- package/src/generators/library/lib/validate-options.d.ts +4 -0
- package/src/generators/library/lib/validate-options.d.ts.map +1 -0
- package/src/generators/library/lib/validate-options.js +27 -0
- package/src/generators/library/library.d.ts.map +1 -1
- package/src/generators/library/library.js +20 -13
- package/src/generators/library/schema.json +3 -4
- package/src/generators/ng-add/migrators/builders/angular-build-unit-test.migrator.d.ts +16 -0
- package/src/generators/ng-add/migrators/builders/angular-build-unit-test.migrator.d.ts.map +1 -0
- package/src/generators/ng-add/migrators/builders/angular-build-unit-test.migrator.js +161 -0
- package/src/generators/ng-add/migrators/builders/index.d.ts +1 -0
- package/src/generators/ng-add/migrators/builders/index.d.ts.map +1 -1
- package/src/generators/ng-add/migrators/builders/index.js +1 -0
- package/src/generators/ng-add/migrators/projects/app.migrator.d.ts.map +1 -1
- package/src/generators/ng-add/migrators/projects/app.migrator.js +1 -0
- package/src/generators/ng-add/migrators/projects/lib.migrator.d.ts.map +1 -1
- package/src/generators/ng-add/migrators/projects/lib.migrator.js +1 -0
- package/src/generators/pipe/files/__fileName__.ts__tpl__ +1 -1
- package/src/generators/pipe/pipe.d.ts.map +1 -1
- package/src/generators/pipe/pipe.js +0 -5
- package/src/generators/remote/files/common/src/main.server.ts__tmpl__ +8 -1
- package/src/generators/remote/lib/index.d.ts +1 -0
- package/src/generators/remote/lib/index.d.ts.map +1 -1
- package/src/generators/remote/lib/index.js +1 -0
- package/src/generators/remote/lib/update-ssr-setup.d.ts +2 -1
- package/src/generators/remote/lib/update-ssr-setup.d.ts.map +1 -1
- package/src/generators/remote/lib/update-ssr-setup.js +7 -7
- package/src/generators/remote/lib/validate-options.d.ts +4 -0
- package/src/generators/remote/lib/validate-options.d.ts.map +1 -0
- package/src/generators/remote/lib/validate-options.js +12 -0
- package/src/generators/remote/remote.d.ts.map +1 -1
- package/src/generators/remote/remote.js +6 -1
- package/src/generators/remote/schema.d.ts +2 -2
- package/src/generators/remote/schema.json +5 -6
- package/src/generators/scam-to-standalone/lib/convert-scam-to-standalone.js +1 -1
- package/src/generators/setup-mf/files/entry-module-files/entry__componentFileSuffix__.ts__tmpl__ +2 -2
- package/src/generators/setup-mf/files/host-files/__appFileName__.spec.ts__tmpl__ +5 -6
- package/src/generators/setup-mf/files/standalone-entry-component-files/entry__componentFileSuffix__.ts__tmpl__ +1 -2
- package/src/generators/setup-mf/lib/add-remote-entry.d.ts.map +1 -1
- package/src/generators/setup-mf/lib/add-remote-entry.js +0 -5
- package/src/generators/setup-mf/lib/update-host-app-routes.d.ts.map +1 -1
- package/src/generators/setup-mf/lib/update-host-app-routes.js +9 -6
- package/src/generators/setup-ssr/files/v20+/application-builder/server/__serverFileName__ +2 -2
- package/src/generators/setup-ssr/files/v20+/server-builder/server/__serverFileName__ +6 -0
- package/src/generators/setup-ssr/lib/add-hydration.d.ts.map +1 -1
- package/src/generators/setup-ssr/lib/add-hydration.js +2 -8
- package/src/generators/setup-ssr/lib/add-server-file.d.ts.map +1 -1
- package/src/generators/setup-ssr/lib/add-server-file.js +7 -7
- package/src/generators/setup-ssr/lib/generate-files.d.ts.map +1 -1
- package/src/generators/setup-ssr/lib/generate-files.js +2 -7
- package/src/generators/setup-ssr/lib/generate-server-ts-config.d.ts.map +1 -1
- package/src/generators/setup-ssr/lib/generate-server-ts-config.js +26 -12
- package/src/generators/setup-ssr/lib/normalize-options.d.ts.map +1 -1
- package/src/generators/setup-ssr/lib/normalize-options.js +1 -5
- package/src/generators/setup-ssr/lib/update-project-config.d.ts.map +1 -1
- package/src/generators/setup-ssr/lib/update-project-config.js +6 -17
- package/src/generators/setup-ssr/lib/validate-options.d.ts.map +1 -1
- package/src/generators/setup-ssr/lib/validate-options.js +9 -0
- package/src/generators/utils/add-jest.d.ts +2 -0
- package/src/generators/utils/add-jest.d.ts.map +1 -1
- package/src/generators/utils/add-jest.js +41 -11
- package/src/generators/utils/add-vitest.d.ts +11 -2
- package/src/generators/utils/add-vitest.d.ts.map +1 -1
- package/src/generators/utils/add-vitest.js +173 -6
- package/src/generators/utils/assert-mf-utils.d.ts +1 -1
- package/src/generators/utils/assert-mf-utils.d.ts.map +1 -1
- package/src/generators/utils/assert-mf-utils.js +1 -4
- package/src/generators/utils/ensure-angular-dependencies.d.ts +1 -1
- package/src/generators/utils/ensure-angular-dependencies.d.ts.map +1 -1
- package/src/generators/utils/ensure-angular-dependencies.js +6 -4
- package/src/generators/utils/storybook-ast/component-info.js +2 -10
- package/src/generators/utils/tsconfig-utils.d.ts +13 -0
- package/src/generators/utils/tsconfig-utils.d.ts.map +1 -0
- package/src/generators/utils/tsconfig-utils.js +29 -0
- package/src/generators/utils/version-utils.d.ts +13 -3
- package/src/generators/utils/version-utils.d.ts.map +1 -1
- package/src/generators/utils/version-utils.js +11 -18
- package/src/migrations/update-21-2-0/update-module-resolution.d.ts.map +1 -1
- package/src/migrations/update-21-2-0/update-module-resolution.js +17 -4
- package/src/migrations/update-22-3-0/update-angular-cli.d.ts +4 -0
- package/src/migrations/update-22-3-0/update-angular-cli.d.ts.map +1 -0
- package/src/migrations/{update-16-4-0 → update-22-3-0}/update-angular-cli.js +1 -1
- package/src/migrations/update-22-3-0/update-module-resolution.d.ts +3 -0
- package/src/migrations/update-22-3-0/update-module-resolution.d.ts.map +1 -0
- package/src/migrations/update-22-3-0/update-module-resolution.js +61 -0
- package/src/migrations/update-22-3-0/update-ssr-webpack-config.d.ts +3 -0
- package/src/migrations/update-22-3-0/update-ssr-webpack-config.d.ts.map +1 -0
- package/src/migrations/update-22-3-0/update-ssr-webpack-config.js +111 -0
- package/src/migrations/update-22-3-0/update-typescript-lib.d.ts +3 -0
- package/src/migrations/update-22-3-0/update-typescript-lib.d.ts.map +1 -0
- package/src/migrations/update-22-3-0/update-typescript-lib.js +98 -0
- package/src/migrations/update-22-3-0/update-unit-test-runner-option.d.ts +3 -0
- package/src/migrations/update-22-3-0/update-unit-test-runner-option.d.ts.map +1 -0
- package/src/migrations/update-22-3-0/update-unit-test-runner-option.js +44 -0
- package/src/plugins/plugin.d.ts.map +1 -1
- package/src/plugins/plugin.js +40 -24
- package/src/utils/backward-compatible-versions.d.ts +7 -9
- package/src/utils/backward-compatible-versions.d.ts.map +1 -1
- package/src/utils/backward-compatible-versions.js +20 -14
- package/src/utils/nx-devkit/ast-utils.d.ts.map +1 -1
- package/src/utils/nx-devkit/ast-utils.js +2 -13
- package/src/utils/targets.d.ts +6 -1
- package/src/utils/targets.d.ts.map +1 -1
- package/src/utils/targets.js +20 -3
- package/src/utils/test-runners.d.ts +2 -1
- package/src/utils/test-runners.d.ts.map +1 -1
- package/src/utils/test-runners.js +2 -1
- package/src/utils/version-utils.d.ts +2 -2
- package/src/utils/version-utils.d.ts.map +1 -1
- package/src/utils/version-utils.js +3 -2
- package/src/utils/versions.d.ts +7 -6
- package/src/utils/versions.d.ts.map +1 -1
- package/src/utils/versions.js +8 -7
- package/src/utils/zoneless.d.ts +3 -0
- package/src/utils/zoneless.d.ts.map +1 -0
- package/src/utils/zoneless.js +28 -0
- package/{mf/index.d.ts → types/nx-angular-mf.d.ts} +1 -1
- package/types/nx-angular-mf.d.ts.map +1 -0
- package/types/nx-angular.d.ts +3 -0
- package/types/nx-angular.d.ts.map +1 -0
- package/index.d.ts +0 -3
- package/index.d.ts.map +0 -1
- package/mf/index.d.ts.map +0 -1
- package/src/executors/utilities/ng-packagr/pre-v19/stylesheet-processor.d.ts +0 -28
- package/src/executors/utilities/ng-packagr/pre-v19/stylesheet-processor.d.ts.map +0 -1
- package/src/executors/utilities/ng-packagr/pre-v19/stylesheet-processor.js +0 -159
- package/src/executors/utilities/ng-packagr/v19+/stylesheet-processor.d.ts.map +0 -1
- package/src/generators/setup-ssr/files/pre-v19/ngmodule-src/__main__ +0 -1
- package/src/generators/setup-ssr/files/pre-v19/ngmodule-src/app/__rootModuleFileName__ +0 -14
- package/src/generators/setup-ssr/files/pre-v19/root/tsconfig.server.json__tpl__ +0 -15
- package/src/generators/setup-ssr/files/pre-v19/server/application-builder/__serverFileName__ +0 -57
- package/src/generators/setup-ssr/files/pre-v19/server/server-builder/__serverFileName__ +0 -72
- package/src/generators/setup-ssr/files/pre-v19/standalone-src/__main__ +0 -12
- package/src/generators/setup-ssr/files/pre-v19/standalone-src/app/app.config.server.ts__tpl__ +0 -11
- package/src/migrations/update-16-2-0/switch-data-persistence-operators-imports-to-ngrx-router-store.d.ts +0 -3
- package/src/migrations/update-16-2-0/switch-data-persistence-operators-imports-to-ngrx-router-store.d.ts.map +0 -1
- package/src/migrations/update-16-2-0/switch-data-persistence-operators-imports-to-ngrx-router-store.js +0 -122
- package/src/migrations/update-16-4-0/rename-angular-eslint-accesibility-rules.d.ts +0 -3
- package/src/migrations/update-16-4-0/rename-angular-eslint-accesibility-rules.d.ts.map +0 -1
- package/src/migrations/update-16-4-0/rename-angular-eslint-accesibility-rules.js +0 -34
- package/src/migrations/update-16-4-0/update-angular-cli.d.ts +0 -4
- package/src/migrations/update-16-4-0/update-angular-cli.d.ts.map +0 -1
- package/src/migrations/update-16-6-0/explicitly-set-projects-to-update-buildable-deps.d.ts +0 -3
- package/src/migrations/update-16-6-0/explicitly-set-projects-to-update-buildable-deps.d.ts.map +0 -1
- package/src/migrations/update-16-6-0/explicitly-set-projects-to-update-buildable-deps.js +0 -34
- package/src/migrations/update-16-7-0/update-angular-cli.d.ts +0 -4
- package/src/migrations/update-16-7-0/update-angular-cli.d.ts.map +0 -1
- package/src/migrations/update-16-7-0/update-angular-cli.js +0 -14
- /package/src/executors/utilities/ng-packagr/{v19+/stylesheet-processor.d.ts → stylesheet-processor.d.ts} +0 -0
|
@@ -4,8 +4,8 @@ exports.updateTsconfigFiles = updateTsconfigFiles;
|
|
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
|
5
5
|
const js_1 = require("@nx/js");
|
|
6
6
|
const configuration_1 = require("@nx/js/src/utils/typescript/configuration");
|
|
7
|
-
const ensure_typescript_1 = require("@nx/js/src/utils/typescript/ensure-typescript");
|
|
8
7
|
const semver_1 = require("semver");
|
|
8
|
+
const tsconfig_utils_1 = require("../../utils/tsconfig-utils");
|
|
9
9
|
const update_app_editor_tsconfig_excluded_files_1 = require("../../utils/update-app-editor-tsconfig-excluded-files");
|
|
10
10
|
const version_utils_1 = require("../../utils/version-utils");
|
|
11
11
|
const enable_strict_type_checking_1 = require("./enable-strict-type-checking");
|
|
@@ -16,24 +16,22 @@ function updateTsconfigFiles(tree, options) {
|
|
|
16
16
|
skipLibCheck: true,
|
|
17
17
|
experimentalDecorators: true,
|
|
18
18
|
importHelpers: true,
|
|
19
|
+
isolatedModules: true,
|
|
19
20
|
target: 'es2022',
|
|
20
21
|
moduleResolution: 'bundler',
|
|
21
22
|
};
|
|
22
23
|
const rootTsConfigPath = (0, js_1.getRootTsConfigFileName)(tree);
|
|
23
24
|
const { major: angularMajorVersion, version: angularVersion } = (0, version_utils_1.getInstalledAngularVersionInfo)(tree);
|
|
24
|
-
if ((0, semver_1.lt)(angularVersion, '18.1.0')) {
|
|
25
|
-
compilerOptions.useDefineForClassFields = false;
|
|
26
|
-
}
|
|
27
|
-
if ((0, semver_1.gte)(angularVersion, '18.2.0')) {
|
|
28
|
-
compilerOptions.isolatedModules = true;
|
|
29
|
-
}
|
|
30
25
|
if ((0, semver_1.gte)(angularVersion, '19.1.0')) {
|
|
31
26
|
// Angular started warning about emitDecoratorMetadata and isolatedModules
|
|
32
27
|
// in v19.1.0. If enabled in the root tsconfig, we need to disable it.
|
|
33
|
-
if (
|
|
28
|
+
if ((0, tsconfig_utils_1.getDefinedCompilerOption)(tree, rootTsConfigPath, 'emitDecoratorMetadata') === true) {
|
|
34
29
|
compilerOptions.emitDecoratorMetadata = false;
|
|
35
30
|
}
|
|
36
31
|
}
|
|
32
|
+
if (angularMajorVersion >= 21) {
|
|
33
|
+
compilerOptions.moduleResolution = 'bundler';
|
|
34
|
+
}
|
|
37
35
|
if (angularMajorVersion >= 20) {
|
|
38
36
|
compilerOptions.module = 'preserve';
|
|
39
37
|
}
|
|
@@ -82,12 +80,3 @@ function updateEditorTsConfig(tree, options) {
|
|
|
82
80
|
const project = (0, devkit_1.readProjectConfiguration)(tree, options.name);
|
|
83
81
|
(0, update_app_editor_tsconfig_excluded_files_1.updateAppEditorTsConfigExcludedFiles)(tree, project);
|
|
84
82
|
}
|
|
85
|
-
function shouldDisableEmitDecoratorMetadata(tree, tsConfigPath) {
|
|
86
|
-
const ts = (0, ensure_typescript_1.ensureTypescript)();
|
|
87
|
-
const tsSysFromTree = {
|
|
88
|
-
...ts.sys,
|
|
89
|
-
readFile: (path) => tree.read(path, 'utf-8'),
|
|
90
|
-
};
|
|
91
|
-
const parsed = ts.parseJsonConfigFileContent(ts.readConfigFile(tsConfigPath, tsSysFromTree.readFile).config, tsSysFromTree, tree.root);
|
|
92
|
-
return parsed.options.emitDecoratorMetadata === true;
|
|
93
|
-
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validate-options.d.ts","sourceRoot":"","sources":["../../../../../../../packages/angular/src/generators/application/lib/validate-options.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAGvC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAExC,wBAAgB,eAAe,CAAC,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,QA6B1D"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.validateOptions = validateOptions;
|
|
4
|
+
const test_runners_1 = require("../../../utils/test-runners");
|
|
5
|
+
const version_utils_1 = require("../../utils/version-utils");
|
|
6
|
+
function validateOptions(tree, options) {
|
|
7
|
+
const { major: angularMajorVersion, version: angularVersion } = (0, version_utils_1.getInstalledAngularVersionInfo)(tree);
|
|
8
|
+
if (angularMajorVersion < 21) {
|
|
9
|
+
if (options.zoneless) {
|
|
10
|
+
throw new Error(`The "zoneless" option is only supported for Angular versions >= 21.0.0. You are using Angular ${angularVersion}.`);
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
if (options.unitTestRunner === test_runners_1.UnitTestRunner.VitestAngular) {
|
|
14
|
+
if (angularMajorVersion < 21) {
|
|
15
|
+
throw new Error(`The "vitest-angular" unit test runner requires Angular v21 or higher. ` +
|
|
16
|
+
`Detected Angular v${angularVersion}. Use "vitest-analog" or "jest" instead.`);
|
|
17
|
+
}
|
|
18
|
+
// Only fail if bundler is explicitly set to a non-esbuild value.
|
|
19
|
+
// If bundler is undefined, it will default to 'esbuild' for Angular v21+.
|
|
20
|
+
if (options.bundler && options.bundler !== 'esbuild') {
|
|
21
|
+
throw new Error(`The "vitest-angular" unit test runner requires the "esbuild" bundler ` +
|
|
22
|
+
`which uses the "@angular/build:application" executor. ` +
|
|
23
|
+
`Use "vitest-analog" or "jest" instead. Or use the "esbuild" bundler.`);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
@@ -99,10 +99,9 @@
|
|
|
99
99
|
},
|
|
100
100
|
"unitTestRunner": {
|
|
101
101
|
"type": "string",
|
|
102
|
-
"enum": ["
|
|
103
|
-
"description": "Test runner to use for unit tests.",
|
|
104
|
-
"x-prompt": "Which unit test runner would you like to use?"
|
|
105
|
-
"default": "jest"
|
|
102
|
+
"enum": ["vitest-angular", "vitest-analog", "jest", "none"],
|
|
103
|
+
"description": "Test runner to use for unit tests. `vitest-angular` uses the `@angular/build:unit-test` executor (requires Angular v21+ and the `esbuild` bundler). `vitest-analog` uses AnalogJS-based setup with `@nx/vitest`. It defaults to `vitest-angular` when using the `esbuild` bundler for Angular versions >= 21.0.0, `vitest-analog` when using other bundlers on Angular >= 21.0.0, otherwise `jest`.",
|
|
104
|
+
"x-prompt": "Which unit test runner would you like to use?"
|
|
106
105
|
},
|
|
107
106
|
"e2eTestRunner": {
|
|
108
107
|
"type": "string",
|
|
@@ -179,6 +178,10 @@
|
|
|
179
178
|
"serverRouting": {
|
|
180
179
|
"description": "Creates a server application using the Server Routing and App Engine APIs for application using the `application` builder (Developer Preview). _Note: this is only supported in Angular versions 19.x.x_. From Angular 20 onwards, SSR will always enable server routing when using the `application` builder.",
|
|
181
180
|
"type": "boolean"
|
|
181
|
+
},
|
|
182
|
+
"zoneless": {
|
|
183
|
+
"description": "Generate an application that does not use `zone.js`. It defaults to `true`. _Note: this is only supported in Angular versions >= 21.0.0_",
|
|
184
|
+
"type": "boolean"
|
|
182
185
|
}
|
|
183
186
|
},
|
|
184
187
|
"additionalProperties": false,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"component.d.ts","sourceRoot":"","sources":["../../../../../../packages/angular/src/generators/component/component.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"component.d.ts","sourceRoot":"","sources":["../../../../../../packages/angular/src/generators/component/component.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAgBvC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAEvC,wBAAsB,kBAAkB,CAAC,IAAI,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,iBA6FtE;AAED,eAAe,kBAAkB,CAAC"}
|
|
@@ -2,12 +2,15 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.componentGenerator = componentGenerator;
|
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
|
5
|
+
const zoneless_1 = require("../../utils/zoneless");
|
|
5
6
|
const utils_1 = require("../utils");
|
|
6
7
|
const version_utils_1 = require("../utils/version-utils");
|
|
7
8
|
const lib_1 = require("./lib");
|
|
8
9
|
async function componentGenerator(tree, rawOptions) {
|
|
9
10
|
const options = await (0, lib_1.normalizeOptions)(tree, rawOptions);
|
|
10
11
|
const { major: angularMajorVersion } = (0, version_utils_1.getInstalledAngularVersionInfo)(tree);
|
|
12
|
+
const project = (0, devkit_1.readProjectConfiguration)(tree, options.projectName);
|
|
13
|
+
const zoneless = (0, zoneless_1.isZonelessApp)(project);
|
|
11
14
|
(0, devkit_1.generateFiles)(tree, (0, devkit_1.joinPathFragments)(__dirname, 'files'), options.directory, {
|
|
12
15
|
name: options.name,
|
|
13
16
|
fileName: options.fileName,
|
|
@@ -22,11 +25,9 @@ async function componentGenerator(tree, rawOptions) {
|
|
|
22
25
|
viewEncapsulation: options.viewEncapsulation,
|
|
23
26
|
displayBlock: options.displayBlock,
|
|
24
27
|
selector: options.selector,
|
|
25
|
-
// Angular v19 or higher defaults to true, while lower versions default to false
|
|
26
|
-
setStandalone: (angularMajorVersion >= 19 && !options.standalone) ||
|
|
27
|
-
(angularMajorVersion < 19 && options.standalone),
|
|
28
28
|
angularMajorVersion,
|
|
29
29
|
ngext: options.ngHtml ? '.ng' : '',
|
|
30
|
+
zoneless,
|
|
30
31
|
tpl: '',
|
|
31
32
|
});
|
|
32
33
|
if (options.skipTests) {
|
|
@@ -12,7 +12,7 @@ describe('<%= symbolName %>', () => {
|
|
|
12
12
|
|
|
13
13
|
fixture = TestBed.createComponent(<%= symbolName %>);
|
|
14
14
|
component = fixture.componentInstance;
|
|
15
|
-
fixture.detectChanges();
|
|
15
|
+
<%= zoneless ? 'await fixture.whenStable();' : 'fixture.detectChanges();' %>
|
|
16
16
|
});
|
|
17
17
|
|
|
18
18
|
it('should create', () => {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { <% if(changeDetection !== 'Default') { %>ChangeDetectionStrategy, <% }%>Component<% if(!!viewEncapsulation) { %>, ViewEncapsulation<% }%> } from '@angular/core';
|
|
2
2
|
|
|
3
3
|
@Component({<% if(!skipSelector) {%>
|
|
4
|
-
selector: '<%= selector %>',<%}%><% if (
|
|
4
|
+
selector: '<%= selector %>',<%}%><% if (!standalone) { %>
|
|
5
5
|
standalone: <%= standalone %>,<% } %>
|
|
6
6
|
imports: [],<% if(inlineTemplate) { %>
|
|
7
7
|
template: `<p><%= name %> works!</p>`<% } else { %>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Tree } from '@nx/devkit';
|
|
2
|
-
import { ComponentTestSchema } from './schema';
|
|
3
|
-
export declare function componentTestGenerator(tree: Tree, options: ComponentTestSchema): Promise<
|
|
1
|
+
import { type GeneratorCallback, type Tree } from '@nx/devkit';
|
|
2
|
+
import type { ComponentTestSchema } from './schema';
|
|
3
|
+
export declare function componentTestGenerator(tree: Tree, options: ComponentTestSchema): Promise<GeneratorCallback>;
|
|
4
4
|
export default componentTestGenerator;
|
|
5
5
|
//# sourceMappingURL=component-test.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"component-test.d.ts","sourceRoot":"","sources":["../../../../../../packages/angular/src/generators/component-test/component-test.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"component-test.d.ts","sourceRoot":"","sources":["../../../../../../packages/angular/src/generators/component-test/component-test.ts"],"names":[],"mappings":"AAAA,OAAO,EAQL,KAAK,iBAAiB,EACtB,KAAK,IAAI,EACV,MAAM,YAAY,CAAC;AAOpB,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAEpD,wBAAsB,sBAAsB,CAC1C,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,mBAAmB,8BAyD7B;AAED,eAAe,sBAAsB,CAAC"}
|
|
@@ -4,6 +4,7 @@ exports.componentTestGenerator = componentTestGenerator;
|
|
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
|
5
5
|
const versions_1 = require("../../utils/versions");
|
|
6
6
|
const storybook_inputs_1 = require("../utils/storybook-ast/storybook-inputs");
|
|
7
|
+
const version_utils_1 = require("../utils/version-utils");
|
|
7
8
|
async function componentTestGenerator(tree, options) {
|
|
8
9
|
(0, devkit_1.ensurePackage)('@nx/cypress', versions_1.nxVersion);
|
|
9
10
|
const { root } = (0, devkit_1.readProjectConfiguration)(tree, options.project);
|
|
@@ -21,8 +22,16 @@ async function componentTestGenerator(tree, options) {
|
|
|
21
22
|
tpl: '',
|
|
22
23
|
});
|
|
23
24
|
}
|
|
25
|
+
const tasks = [];
|
|
26
|
+
if (!options.skipPackageJson) {
|
|
27
|
+
// Cypress CT still requires @angular/platform-browser-dynamic
|
|
28
|
+
tasks.push((0, devkit_1.addDependenciesToPackageJson)(tree, {}, {
|
|
29
|
+
'@angular/platform-browser-dynamic': (0, version_utils_1.versions)(tree).angularVersion,
|
|
30
|
+
}, undefined, true));
|
|
31
|
+
}
|
|
24
32
|
if (!options.skipFormat) {
|
|
25
33
|
await (0, devkit_1.formatFiles)(tree);
|
|
26
34
|
}
|
|
35
|
+
return (0, devkit_1.runTasksInSerial)(...tasks);
|
|
27
36
|
}
|
|
28
37
|
exports.default = componentTestGenerator;
|
|
@@ -41,6 +41,12 @@
|
|
|
41
41
|
"type": "boolean",
|
|
42
42
|
"default": false,
|
|
43
43
|
"x-priority": "internal"
|
|
44
|
+
},
|
|
45
|
+
"skipPackageJson": {
|
|
46
|
+
"type": "boolean",
|
|
47
|
+
"default": false,
|
|
48
|
+
"description": "Do not add dependencies to `package.json`.",
|
|
49
|
+
"x-priority": "internal"
|
|
44
50
|
}
|
|
45
51
|
},
|
|
46
52
|
"additionalProperties": false,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"convert-to-rspack.d.ts","sourceRoot":"","sources":["../../../../../../packages/angular/src/generators/convert-to-rspack/convert-to-rspack.ts"],"names":[],"mappings":"AAAA,OAAO,EAcL,KAAK,iBAAiB,EAEtB,KAAK,IAAI,EACV,MAAM,YAAY,CAAC;AAapB,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,UAAU,CAAC;AA6StD,wBAAsB,eAAe,CACnC,IAAI,EAAE,IAAI,EACV,MAAM,EAAE,qBAAqB,
|
|
1
|
+
{"version":3,"file":"convert-to-rspack.d.ts","sourceRoot":"","sources":["../../../../../../packages/angular/src/generators/convert-to-rspack/convert-to-rspack.ts"],"names":[],"mappings":"AAAA,OAAO,EAcL,KAAK,iBAAiB,EAEtB,KAAK,IAAI,EACV,MAAM,YAAY,CAAC;AAapB,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,UAAU,CAAC;AA6StD,wBAAsB,eAAe,CACnC,IAAI,EAAE,IAAI,EACV,MAAM,EAAE,qBAAqB,8BAiZ9B;AAED,eAAe,eAAe,CAAC"}
|
|
@@ -250,10 +250,6 @@ async function convertToRspack(tree, schema) {
|
|
|
250
250
|
const targetsToRemove = [];
|
|
251
251
|
let customWebpackConfigPath;
|
|
252
252
|
(0, validate_supported_executor_1.validateSupportedBuildExecutor)(Object.values(project.targets));
|
|
253
|
-
const angularRspackVersion = (0, version_utils_1.getAngularRspackVersion)(tree);
|
|
254
|
-
if (!angularRspackVersion) {
|
|
255
|
-
throw new Error('Angular Rspack requires Angular 19 or higher. Please upgrade your Angular version before converting to Rspack.');
|
|
256
|
-
}
|
|
257
253
|
let projectServePort = DEFAULT_PORT;
|
|
258
254
|
const projectServeConfigurationOptions = {};
|
|
259
255
|
for (const [targetName, target] of Object.entries(project.targets)) {
|
|
@@ -508,6 +504,7 @@ async function convertToRspack(tree, schema) {
|
|
|
508
504
|
}
|
|
509
505
|
if (!schema.skipInstall) {
|
|
510
506
|
const { webpackMergeVersion, tsNodeVersion } = (0, version_utils_1.versions)(tree);
|
|
507
|
+
const angularRspackVersion = (0, version_utils_1.getAngularRspackVersion)(tree);
|
|
511
508
|
const installTask = (0, devkit_1.addDependenciesToPackageJson)(tree, {}, {
|
|
512
509
|
'@nx/angular-rspack': angularRspackVersion,
|
|
513
510
|
'webpack-merge': webpackMergeVersion,
|
package/src/generators/cypress-component-configuration/cypress-component-configuration.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cypress-component-configuration.d.ts","sourceRoot":"","sources":["../../../../../../packages/angular/src/generators/cypress-component-configuration/cypress-component-configuration.ts"],"names":[],"mappings":"AAEA,OAAO,EAGL,iBAAiB,
|
|
1
|
+
{"version":3,"file":"cypress-component-configuration.d.ts","sourceRoot":"","sources":["../../../../../../packages/angular/src/generators/cypress-component-configuration/cypress-component-configuration.ts"],"names":[],"mappings":"AAEA,OAAO,EAGL,iBAAiB,EAMjB,IAAI,EAEL,MAAM,YAAY,CAAC;AAYpB,OAAO,EAAE,4BAA4B,EAAE,MAAM,UAAU,CAAC;AAgBxD;;;GAGG;AACH,wBAAsB,6BAA6B,CACjD,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,4BAA4B,GACpC,OAAO,CAAC,iBAAiB,CAAC,CA+C5B;AAmJD,eAAe,6BAA6B,CAAC"}
|
|
@@ -3,61 +3,101 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.cypressComponentConfiguration = cypressComponentConfiguration;
|
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
|
5
5
|
const path_1 = require("path");
|
|
6
|
+
const zoneless_1 = require("../../utils/zoneless");
|
|
6
7
|
const versions_1 = require("../../utils/versions");
|
|
7
8
|
const component_test_1 = require("../component-test/component-test");
|
|
8
9
|
const component_info_1 = require("../utils/storybook-ast/component-info");
|
|
9
10
|
const entry_point_1 = require("../utils/storybook-ast/entry-point");
|
|
10
11
|
const module_info_1 = require("../utils/storybook-ast/module-info");
|
|
11
12
|
const update_app_editor_tsconfig_excluded_files_1 = require("../utils/update-app-editor-tsconfig-excluded-files");
|
|
13
|
+
const webpackExecutors = new Set([
|
|
14
|
+
'@nx/angular:webpack-browser',
|
|
15
|
+
'@nrwl/angular:webpack-browser',
|
|
16
|
+
'@angular-devkit/build-angular:browser',
|
|
17
|
+
]);
|
|
18
|
+
const esbuildExecutors = new Set([
|
|
19
|
+
'@angular/build:application',
|
|
20
|
+
'@angular-devkit/build-angular:application',
|
|
21
|
+
'@nx/angular:application',
|
|
22
|
+
'@angular-devkit/build-angular:browser-esbuild',
|
|
23
|
+
'@nx/angular:browser-esbuild',
|
|
24
|
+
]);
|
|
12
25
|
/**
|
|
13
26
|
* This is for cypress built in component testing, if you want to test with
|
|
14
27
|
* storybook + cypress then use the componentCypressGenerator instead.
|
|
15
28
|
*/
|
|
16
29
|
async function cypressComponentConfiguration(tree, options) {
|
|
17
30
|
const projectConfig = (0, devkit_1.readProjectConfiguration)(tree, options.project);
|
|
31
|
+
// Cypress Component Testing requires Zone.js
|
|
32
|
+
let isZoneless;
|
|
33
|
+
if (projectConfig.projectType === 'application') {
|
|
34
|
+
// For applications, check the polyfills in the build target
|
|
35
|
+
isZoneless = (0, zoneless_1.isZonelessApp)(projectConfig);
|
|
36
|
+
}
|
|
37
|
+
else {
|
|
38
|
+
// For libraries, check if zone.js is installed in the workspace
|
|
39
|
+
isZoneless = (0, devkit_1.getDependencyVersionFromPackageJson)(tree, 'zone.js') === null;
|
|
40
|
+
}
|
|
41
|
+
if (isZoneless) {
|
|
42
|
+
throw new Error(`Cypress Component Testing doesn't support Zoneless Angular projects yet. ` +
|
|
43
|
+
`The project "${options.project}" is configured without Zone.js. ` +
|
|
44
|
+
`See https://github.com/cypress-io/cypress/issues/31504.`);
|
|
45
|
+
}
|
|
18
46
|
const { componentConfigurationGenerator: baseCyCTConfig } = (0, devkit_1.ensurePackage)('@nx/cypress', versions_1.nxVersion);
|
|
19
|
-
const
|
|
47
|
+
const tasks = [];
|
|
48
|
+
tasks.push(await baseCyCTConfig(tree, {
|
|
20
49
|
project: options.project,
|
|
21
50
|
skipFormat: true,
|
|
22
51
|
addPlugin: false,
|
|
23
52
|
addExplicitTargets: true,
|
|
24
|
-
|
|
53
|
+
skipPackageJson: options.skipPackageJson,
|
|
54
|
+
}));
|
|
25
55
|
await configureCypressCT(tree, options);
|
|
26
|
-
await addFiles(tree, projectConfig, options);
|
|
56
|
+
tasks.push(await addFiles(tree, projectConfig, options));
|
|
27
57
|
if (projectConfig.projectType === 'application') {
|
|
28
58
|
(0, update_app_editor_tsconfig_excluded_files_1.updateAppEditorTsConfigExcludedFiles)(tree, projectConfig);
|
|
29
59
|
}
|
|
30
60
|
if (!options.skipFormat) {
|
|
31
61
|
await (0, devkit_1.formatFiles)(tree);
|
|
32
62
|
}
|
|
33
|
-
return
|
|
63
|
+
return (0, devkit_1.runTasksInSerial)(...tasks);
|
|
34
64
|
}
|
|
35
65
|
async function addFiles(tree, projectConfig, options) {
|
|
36
66
|
const componentFile = (0, devkit_1.joinPathFragments)(projectConfig.root, 'cypress', 'support', 'component.ts');
|
|
37
67
|
const { addMountDefinition } = require('@nx/cypress/src/utils/config');
|
|
38
68
|
const updatedCmpContents = await addMountDefinition(tree.read(componentFile, 'utf-8'));
|
|
39
69
|
tree.write(componentFile, `import { mount } from 'cypress/angular';\n${updatedCmpContents}`);
|
|
40
|
-
if (options.generateTests) {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
70
|
+
if (!options.generateTests) {
|
|
71
|
+
return () => { };
|
|
72
|
+
}
|
|
73
|
+
const entryPoints = (0, entry_point_1.getProjectEntryPoints)(tree, options.project);
|
|
74
|
+
const componentInfo = [];
|
|
75
|
+
for (const entryPoint of entryPoints) {
|
|
76
|
+
const moduleFilePaths = (0, module_info_1.getModuleFilePaths)(tree, entryPoint);
|
|
77
|
+
componentInfo.push(...(0, component_info_1.getComponentsInfo)(tree, entryPoint, moduleFilePaths, options.project), ...(0, component_info_1.getStandaloneComponentsInfo)(tree, entryPoint));
|
|
78
|
+
}
|
|
79
|
+
let ctTask;
|
|
80
|
+
for (const info of componentInfo) {
|
|
81
|
+
if (info === undefined) {
|
|
82
|
+
continue;
|
|
46
83
|
}
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
84
|
+
const componentDirFromProjectRoot = (0, path_1.relative)(projectConfig.root, (0, devkit_1.joinPathFragments)(info.moduleFolderPath, info.path));
|
|
85
|
+
const task = await (0, component_test_1.componentTestGenerator)(tree, {
|
|
86
|
+
project: options.project,
|
|
87
|
+
componentName: info.name,
|
|
88
|
+
componentDir: componentDirFromProjectRoot,
|
|
89
|
+
componentFileName: info.componentFileName,
|
|
90
|
+
skipFormat: true,
|
|
91
|
+
skipPackageJson: options.skipPackageJson,
|
|
92
|
+
});
|
|
93
|
+
// the ct generator only installs one dependency, which will only be installed
|
|
94
|
+
// if !skipPackageJson and not already installed, so only the first run can
|
|
95
|
+
// result in a generator callback that would actually install the dependency
|
|
96
|
+
if (!ctTask) {
|
|
97
|
+
ctTask = task;
|
|
59
98
|
}
|
|
60
99
|
}
|
|
100
|
+
return ctTask ?? (() => { });
|
|
61
101
|
}
|
|
62
102
|
async function configureCypressCT(tree, options) {
|
|
63
103
|
let found = { target: options.buildTarget, config: undefined };
|
|
@@ -66,13 +106,25 @@ async function configureCypressCT(tree, options) {
|
|
|
66
106
|
found = await findBuildConfig(tree, {
|
|
67
107
|
project: options.project,
|
|
68
108
|
buildTarget: options.buildTarget,
|
|
69
|
-
validExecutorNames:
|
|
70
|
-
'@nx/angular:webpack-browser',
|
|
71
|
-
'@nrwl/angular:webpack-browser',
|
|
72
|
-
'@angular-devkit/build-angular:browser',
|
|
73
|
-
]),
|
|
109
|
+
validExecutorNames: webpackExecutors,
|
|
74
110
|
});
|
|
75
|
-
|
|
111
|
+
if (!found?.config) {
|
|
112
|
+
// Check if the project uses an esbuild-based executor
|
|
113
|
+
const esbuildTarget = await findBuildConfig(tree, {
|
|
114
|
+
project: options.project,
|
|
115
|
+
validExecutorNames: esbuildExecutors,
|
|
116
|
+
skipGetOptions: true,
|
|
117
|
+
});
|
|
118
|
+
if (esbuildTarget?.target) {
|
|
119
|
+
const projectConfig = (0, devkit_1.readProjectConfiguration)(tree, esbuildTarget.target.split(':')[0]);
|
|
120
|
+
const targetName = esbuildTarget.target.split(':')[1];
|
|
121
|
+
const executor = projectConfig.targets?.[targetName]?.executor;
|
|
122
|
+
throw new Error(`Cypress Component Testing for Angular requires a webpack-based build target, ` +
|
|
123
|
+
`but the project "${options.project}" uses an esbuild-based executor (${executor}).\n\n` +
|
|
124
|
+
`Cypress only supports webpack as the bundler for Angular component testing.`);
|
|
125
|
+
}
|
|
126
|
+
throw new Error('Unable to find a valid build configuration. Try passing in a target for an Angular app (e.g. --build-target=<project>:<target>[:<configuration>]).');
|
|
127
|
+
}
|
|
76
128
|
}
|
|
77
129
|
const ctConfigOptions = {};
|
|
78
130
|
const projectConfig = (0, devkit_1.readProjectConfiguration)(tree, options.project);
|
|
@@ -93,9 +145,4 @@ async function configureCypressCT(tree, options) {
|
|
|
93
145
|
const updatedCyConfig = await addDefaultCTConfig(tree.read(cypressConfigPath, 'utf-8'), ctConfigOptions);
|
|
94
146
|
tree.write(cypressConfigPath, `import { nxComponentTestingPreset } from '@nx/angular/plugins/component-testing';\n${updatedCyConfig}`);
|
|
95
147
|
}
|
|
96
|
-
function assertValidConfig(config) {
|
|
97
|
-
if (!config) {
|
|
98
|
-
throw new Error('Unable to find a valid build configuration. Try passing in a target for an Angular app. --build-target=<project>:<target>[:<configuration>]');
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
148
|
exports.default = cypressComponentConfiguration;
|
|
@@ -33,6 +33,12 @@
|
|
|
33
33
|
"description": "Skip formatting files",
|
|
34
34
|
"default": false,
|
|
35
35
|
"x-priority": "internal"
|
|
36
|
+
},
|
|
37
|
+
"skipPackageJson": {
|
|
38
|
+
"type": "boolean",
|
|
39
|
+
"default": false,
|
|
40
|
+
"description": "Do not add dependencies to `package.json`.",
|
|
41
|
+
"x-priority": "internal"
|
|
36
42
|
}
|
|
37
43
|
},
|
|
38
44
|
"required": ["project"],
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"directive.d.ts","sourceRoot":"","sources":["../../../../../../packages/angular/src/generators/directive/directive.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAKvC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAEvC,wBAAsB,kBAAkB,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"directive.d.ts","sourceRoot":"","sources":["../../../../../../packages/angular/src/generators/directive/directive.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAKvC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAEvC,wBAAsB,kBAAkB,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,iBA6ClE;AAED,eAAe,kBAAkB,CAAC"}
|
|
@@ -13,9 +13,6 @@ 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 versions default to false
|
|
17
|
-
setStandalone: (angularMajorVersion >= 19 && !options.standalone) ||
|
|
18
|
-
(angularMajorVersion < 19 && options.standalone),
|
|
19
16
|
tpl: '',
|
|
20
17
|
});
|
|
21
18
|
if (options.skipTests) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type Tree } from '@nx/devkit';
|
|
2
|
-
import {
|
|
2
|
+
import type { Schema } from './schema';
|
|
3
3
|
export declare function federateModuleGenerator(tree: Tree, schema: Schema): Promise<import("@nx/devkit").GeneratorCallback>;
|
|
4
4
|
export default federateModuleGenerator;
|
|
5
5
|
//# sourceMappingURL=federate-module.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"federate-module.d.ts","sourceRoot":"","sources":["../../../../../../packages/angular/src/generators/federate-module/federate-module.ts"],"names":[],"mappings":"AAAA,OAAO,EAKL,KAAK,IAAI,EACV,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"federate-module.d.ts","sourceRoot":"","sources":["../../../../../../packages/angular/src/generators/federate-module/federate-module.ts"],"names":[],"mappings":"AAAA,OAAO,EAKL,KAAK,IAAI,EACV,MAAM,YAAY,CAAC;AASpB,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAEvC,wBAAsB,uBAAuB,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,mDAgDvE;AAED,eAAe,uBAAuB,CAAC"}
|
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.federateModuleGenerator = federateModuleGenerator;
|
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
|
5
|
+
const test_runners_1 = require("../../utils/test-runners");
|
|
6
|
+
const version_utils_1 = require("../utils/version-utils");
|
|
5
7
|
const lib_1 = require("./lib");
|
|
6
8
|
async function federateModuleGenerator(tree, schema) {
|
|
7
9
|
if (!tree.exists(schema.path)) {
|
|
@@ -10,6 +12,12 @@ async function federateModuleGenerator(tree, schema) {
|
|
|
10
12
|
Path: ${schema.path}`);
|
|
11
13
|
}
|
|
12
14
|
schema.standalone = schema.standalone ?? true;
|
|
15
|
+
const { major: angularMajorVersion } = (0, version_utils_1.getInstalledAngularVersionInfo)(tree);
|
|
16
|
+
// federate-module uses webpack/rspack bundlers, so vitest-angular is not available
|
|
17
|
+
schema.unitTestRunner ??=
|
|
18
|
+
angularMajorVersion >= 21
|
|
19
|
+
? test_runners_1.UnitTestRunner.VitestAnalog
|
|
20
|
+
: test_runners_1.UnitTestRunner.Jest;
|
|
13
21
|
const { tasks, projectRoot, remoteName } = await (0, lib_1.addRemote)(tree, schema);
|
|
14
22
|
(0, lib_1.addFileToRemoteTsconfig)(tree, remoteName, schema.path);
|
|
15
23
|
(0, lib_1.addPathToExposes)(tree, {
|
|
@@ -16,7 +16,7 @@ async function addRemote(tree, schema) {
|
|
|
16
16
|
directory: schema.remoteDirectory,
|
|
17
17
|
host: schema.host,
|
|
18
18
|
standalone: schema.standalone,
|
|
19
|
-
unitTestRunner: schema.unitTestRunner
|
|
19
|
+
unitTestRunner: schema.unitTestRunner,
|
|
20
20
|
e2eTestRunner: schema.e2eTestRunner ?? test_runners_1.E2eTestRunner.Cypress,
|
|
21
21
|
skipFormat: true,
|
|
22
22
|
});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { E2eTestRunner, UnitTestRunner } from '../../utils/test-runners';
|
|
2
2
|
|
|
3
3
|
export interface Schema {
|
|
4
4
|
name: string;
|
|
@@ -6,7 +6,7 @@ export interface Schema {
|
|
|
6
6
|
remote: string;
|
|
7
7
|
remoteDirectory?: string;
|
|
8
8
|
host?: string;
|
|
9
|
-
unitTestRunner?: UnitTestRunner
|
|
9
|
+
unitTestRunner?: Exclude<UnitTestRunner, UnitTestRunner.VitestAngular>;
|
|
10
10
|
e2eTestRunner?: E2eTestRunner;
|
|
11
11
|
standalone?: boolean;
|
|
12
12
|
skipFormat?: boolean;
|
|
@@ -57,10 +57,9 @@
|
|
|
57
57
|
},
|
|
58
58
|
"unitTestRunner": {
|
|
59
59
|
"type": "string",
|
|
60
|
-
"enum": ["
|
|
61
|
-
"description": "Test runner to use for unit tests of the Producer (remote) if it needs to be created.",
|
|
62
|
-
"x-prompt": "Which unit test runner would you like to use?"
|
|
63
|
-
"default": "jest"
|
|
60
|
+
"enum": ["vitest-analog", "jest", "none"],
|
|
61
|
+
"description": "Test runner to use for unit tests of the Producer (remote) if it needs to be created. `vitest-analog` uses AnalogJS-based setup with `@nx/vitest`. It defaults to `vitest-analog` for Angular versions >= 21.0.0, otherwise `jest`.",
|
|
62
|
+
"x-prompt": "Which unit test runner would you like to use?"
|
|
64
63
|
},
|
|
65
64
|
"e2eTestRunner": {
|
|
66
65
|
"type": "string",
|
|
@@ -1,9 +1,16 @@
|
|
|
1
|
+
<%_ if (!zoneless && angularMajorVersion < 21) { _%>
|
|
1
2
|
import 'zone.js/node';
|
|
2
3
|
|
|
4
|
+
<%_ } _%>
|
|
3
5
|
import { APP_BASE_HREF } from '@angular/common';
|
|
4
|
-
import { CommonEngine } from '
|
|
6
|
+
import { CommonEngine } from '@angular/ssr/node';
|
|
7
|
+
<%_ if (useDefaultImport) { _%>
|
|
8
|
+
import express from 'express';
|
|
9
|
+
import cors from 'cors';
|
|
10
|
+
<%_ } else { _%>
|
|
5
11
|
import * as express from 'express';
|
|
6
12
|
import * as cors from 'cors';
|
|
13
|
+
<%_ } _%>
|
|
7
14
|
import { existsSync } from 'node:fs';
|
|
8
15
|
import { join } from 'node:path';
|
|
9
16
|
import<% if(standalone) { %> bootstrap <% } else { %> { AppServerModule } <% } %>from './bootstrap.server';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"host.d.ts","sourceRoot":"","sources":["../../../../../../packages/angular/src/generators/host/host.ts"],"names":[],"mappings":"AAAA,OAAO,EAML,IAAI,EAEL,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"host.d.ts","sourceRoot":"","sources":["../../../../../../packages/angular/src/generators/host/host.ts"],"names":[],"mappings":"AAAA,OAAO,EAML,IAAI,EAEL,MAAM,YAAY,CAAC;AAgBpB,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAEvC,wBAAsB,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,mDAgIpD;AAED,eAAe,IAAI,CAAC"}
|
|
@@ -13,13 +13,17 @@ const setup_mf_1 = require("../setup-mf/setup-mf");
|
|
|
13
13
|
const add_mf_env_to_inputs_1 = require("../utils/add-mf-env-to-inputs");
|
|
14
14
|
const assert_mf_utils_1 = require("../utils/assert-mf-utils");
|
|
15
15
|
const validations_1 = require("../utils/validations");
|
|
16
|
+
const version_utils_1 = require("../utils/version-utils");
|
|
16
17
|
const lib_1 = require("./lib");
|
|
17
18
|
async function host(tree, schema) {
|
|
18
19
|
(0, validations_1.assertNotUsingTsSolutionSetup)(tree, 'host');
|
|
20
|
+
(0, lib_1.validateOptions)(tree, schema);
|
|
19
21
|
// TODO: Replace with Rspack when confidence is high enough
|
|
20
22
|
schema.bundler ??= 'webpack';
|
|
21
23
|
const isRspack = schema.bundler === 'rspack';
|
|
22
|
-
(0, assert_mf_utils_1.assertRspackIsCSR)(schema.bundler, schema.ssr ?? false
|
|
24
|
+
(0, assert_mf_utils_1.assertRspackIsCSR)(schema.bundler, schema.ssr ?? false);
|
|
25
|
+
const { major: angularMajorVersion } = (0, version_utils_1.getInstalledAngularVersionInfo)(tree);
|
|
26
|
+
schema.zoneless ??= angularMajorVersion >= 21 ? true : false;
|
|
23
27
|
const { typescriptConfiguration = true, ...options } = schema;
|
|
24
28
|
options.standalone = options.standalone ?? true;
|
|
25
29
|
const projects = (0, devkit_1.getProjects)(tree);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../packages/angular/src/generators/host/lib/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../packages/angular/src/generators/host/lib/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC"}
|