@nx/angular 16.8.0-beta.4 → 16.8.0-beta.6
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/mf/mf.js +31 -36
- package/package.json +10 -10
- package/plugins/component-testing.d.ts +0 -1
- package/plugins/component-testing.js +48 -40
- package/src/builders/module-federation-dev-server/module-federation-dev-server.impl.js +4 -6
- package/src/builders/module-federation-dev-ssr/module-federation-dev-ssr.impl.js +4 -6
- package/src/builders/utilities/buildable-libs.js +1 -2
- package/src/builders/utilities/module-federation.js +2 -3
- package/src/builders/utilities/webpack.js +16 -21
- package/src/builders/webpack-browser/webpack-browser.impl.js +13 -13
- package/src/builders/webpack-dev-server/lib/normalize-options.js +8 -1
- package/src/builders/webpack-dev-server/webpack-dev-server.impl.js +24 -18
- package/src/builders/webpack-server/webpack-server.impl.js +5 -7
- package/src/executors/browser-esbuild/browser-esbuild.impl.js +19 -23
- package/src/executors/browser-esbuild/lib/buildable-libs.js +1 -2
- package/src/executors/delegate-build/delegate-build.impl.js +9 -12
- package/src/executors/ng-packagr-lite/ng-packagr-adjustments/ng-package/entry-point/compile-ngc.transform.js +4 -7
- package/src/executors/ng-packagr-lite/ng-packagr-adjustments/ng-package/entry-point/entry-point.transform.js +4 -5
- package/src/executors/ng-packagr-lite/ng-packagr-adjustments/ng-package/entry-point/write-package.transform.js +158 -156
- package/src/executors/ng-packagr-lite/ng-packagr-adjustments/ng-package/options.di.js +6 -3
- package/src/executors/ng-packagr-lite/ng-packagr-adjustments/ngc/compile-source-files.js +118 -118
- package/src/executors/ng-packagr-lite/ng-packagr-adjustments/styles/stylesheet-processor.js +96 -103
- package/src/executors/ng-packagr-lite/ng-packagr-adjustments/ts/cache-compiler-host.js +20 -12
- package/src/executors/ng-packagr-lite/ng-packagr-lite.impl.js +18 -21
- package/src/executors/package/ng-packagr-adjustments/ng-package/entry-point/compile-ngc.transform.js +6 -9
- package/src/executors/package/ng-packagr-adjustments/ng-package/options.di.js +6 -3
- package/src/executors/package/ng-packagr-adjustments/ngc/compile-source-files.js +122 -122
- package/src/executors/package/ng-packagr-adjustments/styles/stylesheet-processor.js +96 -103
- package/src/executors/package/ng-packagr-adjustments/ts/cache-compiler-host.js +21 -13
- package/src/executors/package/ng-packagr-adjustments/utils/ng-compiler-cli.js +5 -8
- package/src/executors/package/package.impl.js +33 -38
- package/src/executors/utilities/angular-version-utils.js +1 -1
- package/src/executors/utilities/tailwindcss.js +2 -2
- package/src/executors/utilities/typescript.js +23 -28
- package/src/generators/add-linting/add-linting.js +76 -74
- package/src/generators/add-linting/lib/create-eslint-configuration.js +12 -4
- package/src/generators/application/application.js +56 -55
- package/src/generators/application/lib/add-e2e.js +36 -40
- package/src/generators/application/lib/add-linting.js +12 -15
- package/src/generators/application/lib/add-proxy-config.js +4 -1
- package/src/generators/application/lib/add-unit-test-runner.js +15 -18
- package/src/generators/application/lib/create-files.js +44 -47
- package/src/generators/application/lib/enable-strict-type-checking.js +2 -2
- package/src/generators/application/lib/normalize-options.js +37 -25
- package/src/generators/application/lib/set-app-strict-default.js +1 -2
- package/src/generators/application/lib/update-editor-tsconfig.js +1 -2
- package/src/generators/component/component.js +40 -43
- package/src/generators/component/lib/normalize-options.js +15 -5
- package/src/generators/component-cypress-spec/component-cypress-spec.js +25 -28
- package/src/generators/component-story/component-story.js +19 -22
- package/src/generators/convert-to-with-mf/convert-to-with-mf.js +19 -22
- package/src/generators/convert-to-with-mf/lib/get-webpack-config-path.js +3 -4
- package/src/generators/convert-tslint-to-eslint/convert-tslint-to-eslint.js +103 -106
- package/src/generators/cypress-component-configuration/cypress-component-configuration.js +59 -62
- package/src/generators/directive/directive.js +21 -24
- package/src/generators/directive/lib/normalize-options.js +11 -5
- package/src/generators/host/host.js +77 -67
- package/src/generators/host/lib/add-ssr.js +32 -35
- package/src/generators/init/init.js +101 -92
- package/src/generators/library/lib/add-standalone-component.js +18 -13
- package/src/generators/library/lib/enable-strict-type-checking.js +17 -5
- package/src/generators/library/lib/normalize-options.js +68 -53
- package/src/generators/library/library.js +89 -92
- package/src/generators/library-secondary-entry-point/lib/add-files.js +5 -1
- package/src/generators/library-secondary-entry-point/lib/normalize-options.js +6 -3
- package/src/generators/library-secondary-entry-point/lib/update-linting-file-patterns.js +1 -2
- package/src/generators/library-secondary-entry-point/library-secondary-entry-point.js +6 -9
- package/src/generators/move/lib/normalize-schema.js +5 -1
- package/src/generators/move/lib/update-module-name.js +1 -1
- package/src/generators/move/lib/update-ng-package.js +1 -2
- package/src/generators/move/lib/update-secondary-entry-points.js +1 -2
- package/src/generators/move/move.js +9 -12
- package/src/generators/ng-add/migrate-from-angular-cli.js +54 -53
- package/src/generators/ng-add/migrators/builders/angular-devkit-karma.migrator.js +4 -3
- package/src/generators/ng-add/migrators/builders/angular-devkit-ng-packagr.migrator.js +11 -12
- package/src/generators/ng-add/migrators/builders/angular-eslint-lint.migrator.js +39 -42
- package/src/generators/ng-add/migrators/builders/builder.migrator.js +1 -2
- package/src/generators/ng-add/migrators/migrator.js +7 -11
- package/src/generators/ng-add/migrators/projects/app.migrator.js +39 -43
- package/src/generators/ng-add/migrators/projects/e2e.migrator.js +115 -91
- package/src/generators/ng-add/migrators/projects/lib.migrator.js +23 -31
- package/src/generators/ng-add/migrators/projects/project.migrator.js +10 -14
- package/src/generators/ng-add/ng-add.js +5 -8
- package/src/generators/ng-add/utilities/dependencies.js +2 -3
- package/src/generators/ng-add/utilities/format-files-task.js +1 -1
- package/src/generators/ng-add/utilities/projects.js +1 -1
- package/src/generators/ng-add/utilities/workspace.js +25 -36
- package/src/generators/ngrx/lib/add-imports-to-module.js +1 -2
- package/src/generators/ngrx/lib/add-ngrx-to-package-json.js +1 -3
- package/src/generators/ngrx/lib/generate-files.js +11 -2
- package/src/generators/ngrx/lib/normalize-options.js +9 -4
- package/src/generators/ngrx/lib/validate-options.js +3 -3
- package/src/generators/ngrx/ngrx.js +18 -21
- package/src/generators/ngrx-feature-store/files/base/__directory__/__fileName__.actions.ts__tmpl__ +1 -1
- package/src/generators/ngrx-feature-store/files/base/__directory__/__fileName__.effects.spec.ts__tmpl__ +2 -2
- package/src/generators/ngrx-feature-store/files/base/__directory__/__fileName__.effects.ts__tmpl__ +2 -2
- package/src/generators/ngrx-feature-store/files/base/__directory__/__fileName__.facade.spec.ts__tmpl__ +6 -6
- package/src/generators/ngrx-feature-store/files/base/__directory__/__fileName__.facade.ts__tmpl__ +3 -3
- package/src/generators/ngrx-feature-store/files/base/__directory__/__fileName__.reducer.spec.ts__tmpl__ +3 -3
- package/src/generators/ngrx-feature-store/files/base/__directory__/__fileName__.reducer.ts__tmpl__ +2 -2
- package/src/generators/ngrx-feature-store/files/base/__directory__/__fileName__.selectors.spec.ts__tmpl__ +3 -3
- package/src/generators/ngrx-feature-store/files/base/__directory__/__fileName__.selectors.ts__tmpl__ +1 -1
- package/src/generators/ngrx-feature-store/files/no-inject/__directory__/__fileName__.effects.ts__tmpl__ +2 -2
- package/src/generators/ngrx-feature-store/files/no-inject/__directory__/__fileName__.facade.ts__tmpl__ +3 -3
- package/src/generators/ngrx-feature-store/lib/add-exports-barrel.js +4 -1
- package/src/generators/ngrx-feature-store/lib/add-imports.js +1 -1
- package/src/generators/ngrx-feature-store/lib/add-ngrx-to-package-json.js +1 -3
- package/src/generators/ngrx-feature-store/lib/generate-files.js +20 -4
- package/src/generators/ngrx-feature-store/lib/normalize-options.d.ts +1 -0
- package/src/generators/ngrx-feature-store/lib/normalize-options.js +22 -3
- package/src/generators/ngrx-feature-store/lib/validate-options.js +2 -2
- package/src/generators/ngrx-feature-store/ngrx-feature-store.js +18 -21
- package/src/generators/ngrx-root-store/lib/add-ngrx-to-package-json.js +8 -6
- package/src/generators/ngrx-root-store/lib/normalize-options.js +8 -4
- package/src/generators/ngrx-root-store/lib/validate-options.js +2 -2
- package/src/generators/ngrx-root-store/ngrx-root-store.js +27 -30
- package/src/generators/pipe/lib/normalize-options.js +9 -3
- package/src/generators/pipe/pipe.js +21 -24
- package/src/generators/remote/lib/add-ssr.js +46 -47
- package/src/generators/remote/lib/find-next-available-port.js +1 -2
- package/src/generators/remote/remote.js +52 -49
- package/src/generators/scam/lib/convert-component-to-scam.js +1 -2
- package/src/generators/scam/lib/normalize-options.js +11 -4
- package/src/generators/scam/scam.js +15 -12
- package/src/generators/scam-directive/lib/normalize-options.js +12 -4
- package/src/generators/scam-directive/scam-directive.js +13 -10
- package/src/generators/scam-pipe/lib/normalize-options.js +12 -4
- package/src/generators/scam-pipe/scam-pipe.js +13 -10
- package/src/generators/scam-to-standalone/scam-to-standalone.js +23 -26
- package/src/generators/setup-mf/lib/add-cypress-workaround.js +1 -1
- package/src/generators/setup-mf/lib/add-remote-to-host.js +4 -1
- package/src/generators/setup-mf/lib/change-build-target.js +10 -4
- package/src/generators/setup-mf/lib/generate-config.js +1 -1
- package/src/generators/setup-mf/lib/get-remotes-with-ports.js +1 -2
- package/src/generators/setup-mf/lib/normalize-options.js +5 -2
- package/src/generators/setup-mf/lib/set-tsconfig-target.js +7 -1
- package/src/generators/setup-mf/lib/setup-host-if-dynamic.js +1 -2
- package/src/generators/setup-mf/lib/setup-serve-target.js +11 -4
- package/src/generators/setup-mf/setup-mf.js +32 -35
- package/src/generators/setup-ssr/lib/generate-files.js +8 -5
- package/src/generators/setup-ssr/lib/normalize-options.js +9 -10
- package/src/generators/setup-ssr/lib/update-project-config.js +21 -17
- package/src/generators/setup-ssr/setup-ssr.js +26 -27
- package/src/generators/setup-tailwind/lib/add-tailwind-config-path-to-project.js +6 -4
- package/src/generators/setup-tailwind/lib/detect-tailwind-installed-version.js +1 -2
- package/src/generators/setup-tailwind/lib/normalize-options.js +4 -1
- package/src/generators/setup-tailwind/lib/update-application-styles.js +5 -6
- package/src/generators/setup-tailwind/setup-tailwind.js +20 -23
- package/src/generators/stories/lib/get-e2e-project.js +1 -1
- package/src/generators/stories/stories.js +43 -50
- package/src/generators/storybook-configuration/lib/assert-compatible-storybook-version.js +1 -1
- package/src/generators/storybook-configuration/lib/generate-stories.js +10 -13
- package/src/generators/storybook-configuration/lib/generate-storybook-configuration.js +12 -15
- package/src/generators/storybook-configuration/storybook-configuration.js +20 -16
- package/src/generators/utils/create-ts-config.js +1 -1
- package/src/generators/utils/entry-point.js +1 -2
- package/src/generators/utils/export-scam.js +1 -1
- package/src/generators/utils/insert-ngmodule-import.js +1 -1
- package/src/generators/utils/path.js +3 -3
- package/src/generators/utils/project.js +2 -3
- package/src/generators/utils/selector.js +1 -1
- package/src/generators/utils/storybook-ast/component-info.js +1 -2
- package/src/generators/utils/storybook-ast/entry-point.js +1 -2
- package/src/generators/utils/storybook-ast/module-info.js +1 -2
- package/src/generators/utils/storybook-ast/tree-utilities.js +1 -1
- package/src/generators/utils/testing.js +141 -139
- package/src/generators/utils/validations.js +1 -1
- package/src/generators/utils/version-utils.js +5 -7
- package/src/generators/web-worker/lib/normalize-options.js +6 -3
- package/src/generators/web-worker/web-worker.js +25 -28
- package/src/migrations/update-14-2-0/remove-show-circular-dependencies-option.js +10 -13
- package/src/migrations/update-14-2-0/update-angular-cli.js +14 -18
- package/src/migrations/update-14-2-0/update-libraries-secondary-entrypoints.js +22 -26
- package/src/migrations/update-14-2-0/update-ngcc-target.js +10 -14
- package/src/migrations/update-14-2-0/update-router-initial-navigation.js +31 -39
- package/src/migrations/update-14-2-0/update-tsconfig-target.js +48 -56
- package/src/migrations/update-14-5-0/migrate-mfe-to-mf.js +14 -17
- package/src/migrations/update-14-5-2/update-angular-cli.js +14 -18
- package/src/migrations/update-14-6-0/update-angular-cli.js +14 -18
- package/src/migrations/update-15-0-0/add-karma-inputs.js +27 -32
- package/src/migrations/update-15-0-0/switch-to-jasmine-marbles.js +62 -68
- package/src/migrations/update-15-2-0/remove-browserlist-config.js +34 -37
- package/src/migrations/update-15-2-0/remove-platform-server-exports.js +49 -52
- package/src/migrations/update-15-2-0/update-angular-cli.js +14 -18
- package/src/migrations/update-15-2-0/update-karma-main-file.js +11 -12
- package/src/migrations/update-15-2-0/update-typescript-target.js +40 -39
- package/src/migrations/update-15-2-0/update-workspace-config.js +16 -19
- package/src/migrations/update-15-5-0/update-angular-cli.js +14 -18
- package/src/migrations/update-15-7-0/install-required-packages.js +26 -28
- package/src/migrations/update-15-8-0/update-angular-cli.js +14 -18
- package/src/migrations/update-15-9-0/update-file-server-executor.js +31 -35
- package/src/migrations/update-15-9-0/update-testing-tsconfig.js +17 -22
- package/src/migrations/update-16-0-0/remove-karma-defaults.js +15 -18
- package/src/migrations/update-16-0-0/remove-library-generator-simple-module-name-option.js +22 -25
- package/src/migrations/update-16-0-0/remove-protractor-defaults.js +15 -18
- package/src/migrations/update-16-0-0-add-nx-packages/update-16-0-0-add-nx-packages.js +3 -6
- package/src/migrations/update-16-1-0/extract-standalone-config-from-bootstrap.js +38 -42
- package/src/migrations/update-16-1-0/remove-ngcc-invocation.js +15 -19
- package/src/migrations/update-16-1-0/remove-render-module-platform-server-exports.js +49 -52
- package/src/migrations/update-16-1-0/update-angular-cli.js +14 -18
- package/src/migrations/update-16-1-0/update-server-executor-config.js +13 -16
- package/src/migrations/update-16-2-0/switch-data-persistence-operators-imports-to-ngrx-router-store.js +25 -29
- package/src/migrations/update-16-4-0/rename-angular-eslint-accesibility-rules.js +13 -16
- package/src/migrations/update-16-4-0/update-angular-cli.js +14 -18
- package/src/migrations/update-16-6-0/explicitly-set-projects-to-update-buildable-deps.js +19 -24
- package/src/migrations/update-16-7-0/update-angular-cli.js +14 -18
- package/src/migrations/utils/projects.js +9 -15
- package/src/utils/get-mf-projects.js +1 -2
- package/src/utils/mf/utils.js +43 -44
- package/src/utils/mf/with-module-federation-ssr.js +39 -24
- package/src/utils/mf/with-module-federation.js +40 -21
- package/src/utils/nx-devkit/ast-utils.js +2 -3
- package/src/utils/version-utils.js +2 -4
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.angularInitGenerator = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
4
|
const devkit_1 = require("@nx/devkit");
|
|
6
5
|
const jest_1 = require("@nx/jest");
|
|
7
6
|
const linter_1 = require("@nx/linter");
|
|
@@ -9,75 +8,92 @@ const js_1 = require("@nx/js");
|
|
|
9
8
|
const test_runners_1 = require("../../utils/test-runners");
|
|
10
9
|
const version_utils_1 = require("../utils/version-utils");
|
|
11
10
|
const versions_1 = require("../../utils/versions");
|
|
12
|
-
function angularInitGenerator(tree, rawOptions) {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
}
|
|
11
|
+
async function angularInitGenerator(tree, rawOptions) {
|
|
12
|
+
const tasks = [];
|
|
13
|
+
const options = normalizeOptions(rawOptions);
|
|
14
|
+
const pkgVersions = (0, version_utils_1.versions)(tree);
|
|
15
|
+
const peerDepsToInstall = ['@angular-devkit/core'];
|
|
16
|
+
let devkitVersion;
|
|
17
|
+
peerDepsToInstall.forEach((pkg) => {
|
|
18
|
+
const packageVersion = (0, version_utils_1.getInstalledPackageVersion)(tree, pkg);
|
|
19
|
+
if (!packageVersion) {
|
|
20
|
+
devkitVersion ??=
|
|
21
|
+
(0, version_utils_1.getInstalledPackageVersion)(tree, '@angular-devkit/build-angular') ??
|
|
22
|
+
pkgVersions.angularDevkitVersion;
|
|
23
|
+
try {
|
|
24
|
+
(0, devkit_1.ensurePackage)(pkg, devkitVersion);
|
|
25
|
+
}
|
|
26
|
+
catch {
|
|
27
|
+
// @schematics/angular cannot be required so this fails but this will still allow wrapping the schematic later on
|
|
28
|
+
}
|
|
29
|
+
if (!options.skipPackageJson) {
|
|
30
|
+
tasks.push((0, devkit_1.addDependenciesToPackageJson)(tree, {}, { [pkg]: devkitVersion }));
|
|
33
31
|
}
|
|
34
|
-
});
|
|
35
|
-
setDefaults(tree, options);
|
|
36
|
-
const jsTask = yield (0, js_1.initGenerator)(tree, Object.assign(Object.assign({}, options), { tsConfigName: options.rootProject ? 'tsconfig.json' : 'tsconfig.base.json', js: false, skipFormat: true }));
|
|
37
|
-
tasks.push(jsTask);
|
|
38
|
-
if (!options.skipPackageJson) {
|
|
39
|
-
tasks.push(updateDependencies(tree, pkgVersions));
|
|
40
|
-
}
|
|
41
|
-
const unitTestTask = yield addUnitTestRunner(tree, options, pkgVersions.jestPresetAngularVersion);
|
|
42
|
-
tasks.push(unitTestTask);
|
|
43
|
-
const e2eTask = yield addE2ETestRunner(tree, options);
|
|
44
|
-
tasks.push(e2eTask);
|
|
45
|
-
ignoreAngularCacheDirectory(tree);
|
|
46
|
-
if (!options.skipFormat) {
|
|
47
|
-
yield (0, devkit_1.formatFiles)(tree);
|
|
48
32
|
}
|
|
49
|
-
return (0, devkit_1.runTasksInSerial)(...tasks);
|
|
50
33
|
});
|
|
34
|
+
setDefaults(tree, options);
|
|
35
|
+
const jsTask = await (0, js_1.initGenerator)(tree, {
|
|
36
|
+
...options,
|
|
37
|
+
tsConfigName: options.rootProject ? 'tsconfig.json' : 'tsconfig.base.json',
|
|
38
|
+
js: false,
|
|
39
|
+
skipFormat: true,
|
|
40
|
+
});
|
|
41
|
+
tasks.push(jsTask);
|
|
42
|
+
if (!options.skipPackageJson) {
|
|
43
|
+
tasks.push(updateDependencies(tree, pkgVersions));
|
|
44
|
+
}
|
|
45
|
+
const unitTestTask = await addUnitTestRunner(tree, options, pkgVersions.jestPresetAngularVersion);
|
|
46
|
+
tasks.push(unitTestTask);
|
|
47
|
+
const e2eTask = await addE2ETestRunner(tree, options);
|
|
48
|
+
tasks.push(e2eTask);
|
|
49
|
+
ignoreAngularCacheDirectory(tree);
|
|
50
|
+
if (!options.skipFormat) {
|
|
51
|
+
await (0, devkit_1.formatFiles)(tree);
|
|
52
|
+
}
|
|
53
|
+
return (0, devkit_1.runTasksInSerial)(...tasks);
|
|
51
54
|
}
|
|
52
55
|
exports.angularInitGenerator = angularInitGenerator;
|
|
53
56
|
function normalizeOptions(options) {
|
|
54
|
-
var _a, _b, _c, _d, _e, _f, _g;
|
|
55
57
|
return {
|
|
56
|
-
e2eTestRunner:
|
|
57
|
-
linter:
|
|
58
|
-
skipFormat:
|
|
59
|
-
skipInstall:
|
|
60
|
-
skipPackageJson:
|
|
61
|
-
style:
|
|
62
|
-
unitTestRunner:
|
|
58
|
+
e2eTestRunner: options.e2eTestRunner ?? test_runners_1.E2eTestRunner.Cypress,
|
|
59
|
+
linter: options.linter ?? linter_1.Linter.EsLint,
|
|
60
|
+
skipFormat: options.skipFormat ?? false,
|
|
61
|
+
skipInstall: options.skipInstall ?? false,
|
|
62
|
+
skipPackageJson: options.skipPackageJson ?? false,
|
|
63
|
+
style: options.style ?? 'css',
|
|
64
|
+
unitTestRunner: options.unitTestRunner ?? test_runners_1.UnitTestRunner.Jest,
|
|
63
65
|
rootProject: options.rootProject,
|
|
64
66
|
};
|
|
65
67
|
}
|
|
66
68
|
function setDefaults(host, options) {
|
|
67
69
|
const nxJson = (0, devkit_1.readNxJson)(host);
|
|
68
70
|
nxJson.generators = nxJson.generators || {};
|
|
69
|
-
nxJson.generators['@nx/angular:application'] =
|
|
70
|
-
|
|
71
|
-
|
|
71
|
+
nxJson.generators['@nx/angular:application'] = {
|
|
72
|
+
style: options.style,
|
|
73
|
+
linter: options.linter,
|
|
74
|
+
unitTestRunner: options.unitTestRunner,
|
|
75
|
+
e2eTestRunner: options.e2eTestRunner,
|
|
76
|
+
...(nxJson.generators['@nx/angular:application'] || {}),
|
|
77
|
+
};
|
|
78
|
+
nxJson.generators['@nx/angular:library'] = {
|
|
79
|
+
linter: options.linter,
|
|
80
|
+
unitTestRunner: options.unitTestRunner,
|
|
81
|
+
...(nxJson.generators['@nx/angular:library'] || {}),
|
|
82
|
+
};
|
|
83
|
+
nxJson.generators['@nx/angular:component'] = {
|
|
84
|
+
style: options.style,
|
|
85
|
+
...(nxJson.generators['@nx/angular:component'] || {}),
|
|
86
|
+
};
|
|
72
87
|
(0, devkit_1.updateNxJson)(host, nxJson);
|
|
73
88
|
}
|
|
74
89
|
function updateDependencies(tree, versions) {
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
const angularDevkitVersion = (
|
|
78
|
-
|
|
79
|
-
const
|
|
80
|
-
const
|
|
90
|
+
const angularVersion = (0, version_utils_1.getInstalledPackageVersion)(tree, '@angular/core') ??
|
|
91
|
+
versions.angularVersion;
|
|
92
|
+
const angularDevkitVersion = (0, version_utils_1.getInstalledPackageVersion)(tree, '@angular-devkit/build-angular') ??
|
|
93
|
+
versions.angularDevkitVersion;
|
|
94
|
+
const rxjsVersion = (0, version_utils_1.getInstalledPackageVersion)(tree, 'rxjs') ?? versions.rxjsVersion;
|
|
95
|
+
const tsLibVersion = (0, version_utils_1.getInstalledPackageVersion)(tree, 'tslib') ?? versions.tsLibVersion;
|
|
96
|
+
const zoneJsVersion = (0, version_utils_1.getInstalledPackageVersion)(tree, 'zone.js') ?? versions.zoneJsVersion;
|
|
81
97
|
return (0, version_utils_1.addDependenciesToPackageJsonIfDontExist)(tree, {
|
|
82
98
|
'@angular/animations': angularVersion,
|
|
83
99
|
'@angular/common': angularVersion,
|
|
@@ -99,51 +115,44 @@ function updateDependencies(tree, versions) {
|
|
|
99
115
|
'@schematics/angular': angularDevkitVersion,
|
|
100
116
|
});
|
|
101
117
|
}
|
|
102
|
-
function addUnitTestRunner(tree, options, jestPresetAngularVersion) {
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
(_a = (_b = process.env).npm_config_legacy_peer_deps) !== null && _a !== void 0 ? _a : (_b.npm_config_legacy_peer_deps = 'true');
|
|
110
|
-
(0, version_utils_1.addDependenciesToPackageJsonIfDontExist)(tree, {}, {
|
|
111
|
-
'jest-preset-angular': jestPresetAngularVersion,
|
|
112
|
-
});
|
|
113
|
-
}
|
|
114
|
-
return (0, jest_1.jestInitGenerator)(tree, {
|
|
115
|
-
skipPackageJson: options.skipPackageJson,
|
|
118
|
+
async function addUnitTestRunner(tree, options, jestPresetAngularVersion) {
|
|
119
|
+
switch (options.unitTestRunner) {
|
|
120
|
+
case test_runners_1.UnitTestRunner.Jest:
|
|
121
|
+
if (!options.skipPackageJson) {
|
|
122
|
+
process.env.npm_config_legacy_peer_deps ??= 'true';
|
|
123
|
+
(0, version_utils_1.addDependenciesToPackageJsonIfDontExist)(tree, {}, {
|
|
124
|
+
'jest-preset-angular': jestPresetAngularVersion,
|
|
116
125
|
});
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
126
|
+
}
|
|
127
|
+
return (0, jest_1.jestInitGenerator)(tree, {
|
|
128
|
+
skipPackageJson: options.skipPackageJson,
|
|
129
|
+
});
|
|
130
|
+
default:
|
|
131
|
+
return () => { };
|
|
132
|
+
}
|
|
121
133
|
}
|
|
122
|
-
function addE2ETestRunner(tree, options) {
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
}
|
|
139
|
-
});
|
|
134
|
+
async function addE2ETestRunner(tree, options) {
|
|
135
|
+
switch (options.e2eTestRunner) {
|
|
136
|
+
case test_runners_1.E2eTestRunner.Cypress:
|
|
137
|
+
const { cypressInitGenerator } = (0, devkit_1.ensurePackage)('@nx/cypress', versions_1.nxVersion);
|
|
138
|
+
return cypressInitGenerator(tree, {
|
|
139
|
+
skipPackageJson: options.skipPackageJson,
|
|
140
|
+
});
|
|
141
|
+
case test_runners_1.E2eTestRunner.Playwright:
|
|
142
|
+
const { initGenerator: playwrightInitGenerator } = (0, devkit_1.ensurePackage)('@nx/playwright', versions_1.nxVersion);
|
|
143
|
+
return playwrightInitGenerator(tree, {
|
|
144
|
+
skipFormat: true,
|
|
145
|
+
skipPackageJson: options.skipPackageJson,
|
|
146
|
+
});
|
|
147
|
+
default:
|
|
148
|
+
return () => { };
|
|
149
|
+
}
|
|
140
150
|
}
|
|
141
151
|
function ignoreAngularCacheDirectory(tree) {
|
|
142
|
-
var _a, _b;
|
|
143
152
|
const { cli } = (0, devkit_1.readNxJson)(tree);
|
|
144
153
|
// angular-specific cli config is supported though is not included in the
|
|
145
154
|
// NxJsonConfiguration type
|
|
146
|
-
const angularCacheDir =
|
|
155
|
+
const angularCacheDir = cli?.cache?.path ?? '.angular';
|
|
147
156
|
addGitIgnoreEntry(tree, angularCacheDir);
|
|
148
157
|
addPrettierIgnoreEntry(tree, angularCacheDir);
|
|
149
158
|
}
|
|
@@ -1,23 +1,28 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.addStandaloneComponent = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
4
|
const component_1 = require("../../component/component");
|
|
6
5
|
const add_load_children_1 = require("./add-load-children");
|
|
7
6
|
const add_children_1 = require("./add-children");
|
|
8
|
-
function addStandaloneComponent(tree, { libraryOptions, componentOptions }) {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
7
|
+
async function addStandaloneComponent(tree, { libraryOptions, componentOptions }) {
|
|
8
|
+
await (0, component_1.default)(tree, {
|
|
9
|
+
...componentOptions,
|
|
10
|
+
name: componentOptions.name,
|
|
11
|
+
standalone: true,
|
|
12
|
+
export: true,
|
|
13
|
+
project: libraryOptions.name,
|
|
14
|
+
flat: componentOptions.flat,
|
|
15
|
+
skipFormat: true,
|
|
16
|
+
});
|
|
17
|
+
if (libraryOptions.routing) {
|
|
18
|
+
if (libraryOptions.parent) {
|
|
19
|
+
if (libraryOptions.lazy) {
|
|
20
|
+
(0, add_load_children_1.addLoadChildren)(tree, libraryOptions);
|
|
21
|
+
}
|
|
22
|
+
else {
|
|
23
|
+
(0, add_children_1.addChildren)(tree, libraryOptions);
|
|
19
24
|
}
|
|
20
25
|
}
|
|
21
|
-
}
|
|
26
|
+
}
|
|
22
27
|
}
|
|
23
28
|
exports.addStandaloneComponent = addStandaloneComponent;
|
|
@@ -10,7 +10,6 @@ function enableStrictTypeChecking(host, options) {
|
|
|
10
10
|
}
|
|
11
11
|
exports.enableStrictTypeChecking = enableStrictTypeChecking;
|
|
12
12
|
function setLibraryStrictDefault(host, isStrict) {
|
|
13
|
-
var _a;
|
|
14
13
|
// set the default so future libraries use it
|
|
15
14
|
// unless the user has previously set this value
|
|
16
15
|
const nxJson = (0, devkit_1.readNxJson)(host);
|
|
@@ -18,7 +17,7 @@ function setLibraryStrictDefault(host, isStrict) {
|
|
|
18
17
|
nxJson.generators['@nx/angular:library'] =
|
|
19
18
|
nxJson.generators['@nx/angular:library'] || {};
|
|
20
19
|
nxJson.generators['@nx/angular:library'].strict =
|
|
21
|
-
|
|
20
|
+
nxJson.generators['@nx/angular:library'].strict ?? isStrict;
|
|
22
21
|
(0, devkit_1.updateNxJson)(host, nxJson);
|
|
23
22
|
}
|
|
24
23
|
exports.setLibraryStrictDefault = setLibraryStrictDefault;
|
|
@@ -26,11 +25,24 @@ function updateTsConfig(host, options) {
|
|
|
26
25
|
// Update the settings in the tsconfig.app.json to enable strict type checking.
|
|
27
26
|
// This matches the settings defined by the Angular CL https://angular.io/guide/strict-mode
|
|
28
27
|
(0, devkit_1.updateJson)(host, `${options.projectRoot}/tsconfig.json`, (json) => {
|
|
29
|
-
var _a, _b;
|
|
30
28
|
// update the TypeScript settings
|
|
31
|
-
json.compilerOptions =
|
|
29
|
+
json.compilerOptions = {
|
|
30
|
+
...(json.compilerOptions ?? {}),
|
|
31
|
+
forceConsistentCasingInFileNames: true,
|
|
32
|
+
strict: true,
|
|
33
|
+
noImplicitOverride: true,
|
|
34
|
+
noPropertyAccessFromIndexSignature: true,
|
|
35
|
+
noImplicitReturns: true,
|
|
36
|
+
noFallthroughCasesInSwitch: true,
|
|
37
|
+
};
|
|
32
38
|
// update Angular Template Settings
|
|
33
|
-
json.angularCompilerOptions =
|
|
39
|
+
json.angularCompilerOptions = {
|
|
40
|
+
...(json.angularCompilerOptions ?? {}),
|
|
41
|
+
enableI18nLegacyMessageIdFormat: false,
|
|
42
|
+
strictInjectionParameters: true,
|
|
43
|
+
strictInputAccessModifiers: true,
|
|
44
|
+
strictTemplates: true,
|
|
45
|
+
};
|
|
34
46
|
return json;
|
|
35
47
|
});
|
|
36
48
|
}
|
|
@@ -1,65 +1,80 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.normalizeOptions = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
4
|
const devkit_1 = require("@nx/devkit");
|
|
6
5
|
const project_name_and_root_utils_1 = require("@nx/devkit/src/generators/project-name-and-root-utils");
|
|
7
6
|
const get_npm_scope_1 = require("@nx/js/src/utils/package-json/get-npm-scope");
|
|
8
7
|
const linter_1 = require("@nx/linter");
|
|
9
8
|
const test_runners_1 = require("../../../utils/test-runners");
|
|
10
9
|
const project_1 = require("../../utils/project");
|
|
11
|
-
function normalizeOptions(host, schema) {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
: [];
|
|
35
|
-
const modulePath = `${projectRoot}/src/lib/${fileName}.module.ts`;
|
|
36
|
-
const npmScope = (0, get_npm_scope_1.getNpmScope)(host);
|
|
37
|
-
const prefix = (0, project_1.normalizeNewProjectPrefix)(options.prefix, npmScope, 'lib');
|
|
38
|
-
const ngCliSchematicLibRoot = projectName;
|
|
39
|
-
const allNormalizedOptions = Object.assign(Object.assign({}, options), { linter: (_b = options.linter) !== null && _b !== void 0 ? _b : linter_1.Linter.EsLint, unitTestRunner: (_c = options.unitTestRunner) !== null && _c !== void 0 ? _c : test_runners_1.UnitTestRunner.Jest, prefix, name: projectName, projectRoot, entryFile: 'index', moduleName,
|
|
40
|
-
modulePath,
|
|
41
|
-
parsedTags,
|
|
42
|
-
fileName,
|
|
43
|
-
importPath,
|
|
44
|
-
ngCliSchematicLibRoot, standaloneComponentName: `${(0, devkit_1.names)(projectNames.projectSimpleName).className}Component` });
|
|
45
|
-
const { displayBlock, inlineStyle, inlineTemplate, viewEncapsulation, changeDetection, style, skipTests, selector, skipSelector, flat } = allNormalizedOptions, libraryOptions = tslib_1.__rest(allNormalizedOptions, ["displayBlock", "inlineStyle", "inlineTemplate", "viewEncapsulation", "changeDetection", "style", "skipTests", "selector", "skipSelector", "flat"]);
|
|
46
|
-
return {
|
|
47
|
-
libraryOptions,
|
|
48
|
-
componentOptions: {
|
|
49
|
-
name: fileName,
|
|
50
|
-
standalone: libraryOptions.standalone,
|
|
51
|
-
displayBlock,
|
|
52
|
-
inlineStyle,
|
|
53
|
-
inlineTemplate,
|
|
54
|
-
viewEncapsulation,
|
|
55
|
-
changeDetection,
|
|
56
|
-
style,
|
|
57
|
-
skipTests,
|
|
58
|
-
selector,
|
|
59
|
-
skipSelector,
|
|
60
|
-
flat,
|
|
61
|
-
},
|
|
62
|
-
};
|
|
10
|
+
async function normalizeOptions(host, schema) {
|
|
11
|
+
// Create a schema with populated default values
|
|
12
|
+
const options = {
|
|
13
|
+
buildable: false,
|
|
14
|
+
linter: linter_1.Linter.EsLint,
|
|
15
|
+
publishable: false,
|
|
16
|
+
simpleName: false,
|
|
17
|
+
skipFormat: false,
|
|
18
|
+
unitTestRunner: test_runners_1.UnitTestRunner.Jest,
|
|
19
|
+
// Publishable libs cannot use `full` yet, so if its false then use the passed value or default to `full`
|
|
20
|
+
compilationMode: schema.publishable
|
|
21
|
+
? 'partial'
|
|
22
|
+
: schema.compilationMode ?? 'full',
|
|
23
|
+
skipModule: schema.skipModule || schema.standalone,
|
|
24
|
+
...schema,
|
|
25
|
+
};
|
|
26
|
+
const { projectName, names: projectNames, projectRoot, importPath, } = await (0, project_name_and_root_utils_1.determineProjectNameAndRootOptions)(host, {
|
|
27
|
+
name: options.name,
|
|
28
|
+
projectType: 'library',
|
|
29
|
+
directory: options.directory,
|
|
30
|
+
importPath: options.importPath,
|
|
31
|
+
projectNameAndRootFormat: options.projectNameAndRootFormat,
|
|
32
|
+
callingGenerator: '@nx/angular:library',
|
|
63
33
|
});
|
|
34
|
+
const fileName = options.simpleName
|
|
35
|
+
? projectNames.projectSimpleName
|
|
36
|
+
: projectNames.projectFileName;
|
|
37
|
+
const moduleName = `${(0, devkit_1.names)(fileName).className}Module`;
|
|
38
|
+
const parsedTags = options.tags
|
|
39
|
+
? options.tags.split(',').map((s) => s.trim())
|
|
40
|
+
: [];
|
|
41
|
+
const modulePath = `${projectRoot}/src/lib/${fileName}.module.ts`;
|
|
42
|
+
const npmScope = (0, get_npm_scope_1.getNpmScope)(host);
|
|
43
|
+
const prefix = (0, project_1.normalizeNewProjectPrefix)(options.prefix, npmScope, 'lib');
|
|
44
|
+
const ngCliSchematicLibRoot = projectName;
|
|
45
|
+
const allNormalizedOptions = {
|
|
46
|
+
...options,
|
|
47
|
+
linter: options.linter ?? linter_1.Linter.EsLint,
|
|
48
|
+
unitTestRunner: options.unitTestRunner ?? test_runners_1.UnitTestRunner.Jest,
|
|
49
|
+
prefix,
|
|
50
|
+
name: projectName,
|
|
51
|
+
projectRoot,
|
|
52
|
+
entryFile: 'index',
|
|
53
|
+
moduleName,
|
|
54
|
+
modulePath,
|
|
55
|
+
parsedTags,
|
|
56
|
+
fileName,
|
|
57
|
+
importPath,
|
|
58
|
+
ngCliSchematicLibRoot,
|
|
59
|
+
standaloneComponentName: `${(0, devkit_1.names)(projectNames.projectSimpleName).className}Component`,
|
|
60
|
+
};
|
|
61
|
+
const { displayBlock, inlineStyle, inlineTemplate, viewEncapsulation, changeDetection, style, skipTests, selector, skipSelector, flat, ...libraryOptions } = allNormalizedOptions;
|
|
62
|
+
return {
|
|
63
|
+
libraryOptions,
|
|
64
|
+
componentOptions: {
|
|
65
|
+
name: fileName,
|
|
66
|
+
standalone: libraryOptions.standalone,
|
|
67
|
+
displayBlock,
|
|
68
|
+
inlineStyle,
|
|
69
|
+
inlineTemplate,
|
|
70
|
+
viewEncapsulation,
|
|
71
|
+
changeDetection,
|
|
72
|
+
style,
|
|
73
|
+
skipTests,
|
|
74
|
+
selector,
|
|
75
|
+
skipSelector,
|
|
76
|
+
flat,
|
|
77
|
+
},
|
|
78
|
+
};
|
|
64
79
|
}
|
|
65
80
|
exports.normalizeOptions = normalizeOptions;
|