@nx/angular 16.8.0-beta.3 → 16.8.0-beta.5
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/migrations.json +9 -0
- package/package.json +11 -11
- package/plugins/component-testing.js +82 -44
- 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 -69
- package/src/generators/add-linting/lib/add-angular-eslint-dependencies.js +2 -0
- 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/files/src/main.server.ts__tmpl__ +1 -1
- package/src/generators/host/host.js +77 -67
- package/src/generators/host/lib/add-ssr.js +32 -33
- 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/files/base/src/main.server.ts__tmpl__ +2 -2
- package/src/generators/remote/lib/add-ssr.js +46 -43
- 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 +10 -3
- 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 -138
- 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/backward-compatible-versions.js +2 -0
- 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/nx-devkit/testing.js +9 -9
- package/src/utils/version-utils.js +2 -4
- package/src/utils/versions.d.ts +1 -0
- package/src/utils/versions.js +2 -1
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.createStorybookTestWorkspaceForLib = exports.generateTestLibrary = exports.generateTestRemoteApplication = exports.generateTestHostApplication = exports.generateTestApplication = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
4
|
const devkit_1 = require("@nx/devkit");
|
|
6
5
|
const testing_1 = require("@nx/devkit/testing");
|
|
7
6
|
const linter_1 = require("@nx/linter");
|
|
@@ -12,57 +11,55 @@ const component_1 = require("../component/component");
|
|
|
12
11
|
const host_1 = require("../host/host");
|
|
13
12
|
const library_1 = require("../library/library");
|
|
14
13
|
const remote_1 = require("../remote/remote");
|
|
15
|
-
function generateTestApplication(tree, options) {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
14
|
+
async function generateTestApplication(tree, options) {
|
|
15
|
+
addAngularPluginPeerDeps(tree);
|
|
16
|
+
tree.write('.gitignore', '');
|
|
17
|
+
await (0, application_1.applicationGenerator)(tree, {
|
|
18
|
+
projectNameAndRootFormat: 'as-provided',
|
|
19
|
+
...options,
|
|
20
20
|
});
|
|
21
21
|
}
|
|
22
22
|
exports.generateTestApplication = generateTestApplication;
|
|
23
|
-
function generateTestHostApplication(tree, options) {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
yield (0, host_1.host)(tree, options);
|
|
28
|
-
});
|
|
23
|
+
async function generateTestHostApplication(tree, options) {
|
|
24
|
+
addAngularPluginPeerDeps(tree);
|
|
25
|
+
tree.write('.gitignore', '');
|
|
26
|
+
await (0, host_1.host)(tree, { projectNameAndRootFormat: 'as-provided', ...options });
|
|
29
27
|
}
|
|
30
28
|
exports.generateTestHostApplication = generateTestHostApplication;
|
|
31
|
-
function generateTestRemoteApplication(tree, options) {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
yield (0, remote_1.remote)(tree, options);
|
|
36
|
-
});
|
|
29
|
+
async function generateTestRemoteApplication(tree, options) {
|
|
30
|
+
addAngularPluginPeerDeps(tree);
|
|
31
|
+
tree.write('.gitignore', '');
|
|
32
|
+
await (0, remote_1.remote)(tree, { projectNameAndRootFormat: 'as-provided', ...options });
|
|
37
33
|
}
|
|
38
34
|
exports.generateTestRemoteApplication = generateTestRemoteApplication;
|
|
39
|
-
function generateTestLibrary(tree, options) {
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
35
|
+
async function generateTestLibrary(tree, options) {
|
|
36
|
+
addAngularPluginPeerDeps(tree);
|
|
37
|
+
tree.write('.gitignore', '');
|
|
38
|
+
await (0, library_1.libraryGenerator)(tree, {
|
|
39
|
+
projectNameAndRootFormat: 'as-provided',
|
|
40
|
+
...options,
|
|
44
41
|
});
|
|
45
42
|
}
|
|
46
43
|
exports.generateTestLibrary = generateTestLibrary;
|
|
47
|
-
function createStorybookTestWorkspaceForLib(libName) {
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
44
|
+
async function createStorybookTestWorkspaceForLib(libName) {
|
|
45
|
+
let tree = (0, testing_1.createTreeWithEmptyWorkspace)({ layout: 'apps-libs' });
|
|
46
|
+
addAngularPluginPeerDeps(tree);
|
|
47
|
+
tree.write('.gitignore', '');
|
|
48
|
+
await (0, library_1.libraryGenerator)(tree, {
|
|
49
|
+
name: libName,
|
|
50
|
+
buildable: false,
|
|
51
|
+
linter: linter_1.Linter.EsLint,
|
|
52
|
+
publishable: false,
|
|
53
|
+
simpleName: false,
|
|
54
|
+
skipFormat: false,
|
|
55
|
+
unitTestRunner: test_runners_1.UnitTestRunner.Jest,
|
|
56
|
+
projectNameAndRootFormat: 'as-provided',
|
|
57
|
+
});
|
|
58
|
+
await (0, component_1.componentGenerator)(tree, {
|
|
59
|
+
name: 'test-button',
|
|
60
|
+
project: libName,
|
|
61
|
+
});
|
|
62
|
+
tree.write(`${libName}/src/lib/test-button/test-button.component.ts`, `import { Component, Input } from '@angular/core';
|
|
66
63
|
|
|
67
64
|
export type ButtonStyle = 'default' | 'primary' | 'accent';
|
|
68
65
|
|
|
@@ -77,23 +74,23 @@ export class TestButtonComponent {
|
|
|
77
74
|
@Input() age?: number;
|
|
78
75
|
@Input() isOn = false;
|
|
79
76
|
}`);
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
77
|
+
tree.write(`${libName}/src/lib/test-button/test-button.component.html`, `<button [attr.type]="type" [ngClass]="style"></button>`);
|
|
78
|
+
const modulePath = `${libName}/src/lib/${libName}.module.ts`;
|
|
79
|
+
tree.write(modulePath, `import * as ButtonExports from './test-button/test-button.component';
|
|
83
80
|
${tree.read(modulePath)}`);
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
81
|
+
// create a module with component that gets exported in a barrel file
|
|
82
|
+
generateModule(tree, {
|
|
83
|
+
name: 'barrel',
|
|
84
|
+
project: libName,
|
|
85
|
+
});
|
|
86
|
+
await (0, component_1.componentGenerator)(tree, {
|
|
87
|
+
name: 'barrel-button',
|
|
88
|
+
project: libName,
|
|
89
|
+
path: `${libName}/src/lib/barrel`,
|
|
90
|
+
module: 'barrel',
|
|
91
|
+
});
|
|
92
|
+
tree.write(`${libName}/src/lib/barrel/barrel-button/index.ts`, `export * from './barrel-button.component';`);
|
|
93
|
+
tree.write(`${libName}/src/lib/barrel/barrel.module.ts`, `import { NgModule } from '@angular/core';
|
|
97
94
|
import { CommonModule } from '@angular/common';
|
|
98
95
|
import { BarrelButtonComponent } from './barrel-button';
|
|
99
96
|
|
|
@@ -102,24 +99,24 @@ import { BarrelButtonComponent } from './barrel-button';
|
|
|
102
99
|
declarations: [BarrelButtonComponent],
|
|
103
100
|
})
|
|
104
101
|
export class BarrelModule {}`);
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
102
|
+
// create a module with components that get Angular exported and declared by variable
|
|
103
|
+
generateModule(tree, {
|
|
104
|
+
name: 'variable-declare',
|
|
105
|
+
project: libName,
|
|
106
|
+
});
|
|
107
|
+
await (0, component_1.componentGenerator)(tree, {
|
|
108
|
+
name: 'variable-declare-button',
|
|
109
|
+
project: libName,
|
|
110
|
+
path: `${libName}/src/lib/variable-declare`,
|
|
111
|
+
module: 'variable-declare',
|
|
112
|
+
});
|
|
113
|
+
await (0, component_1.componentGenerator)(tree, {
|
|
114
|
+
name: 'variable-declare-view',
|
|
115
|
+
project: libName,
|
|
116
|
+
path: `${libName}/src/lib/variable-declare`,
|
|
117
|
+
module: 'variable-declare',
|
|
118
|
+
});
|
|
119
|
+
tree.write(`${libName}/src/lib/variable-declare/variable-declare.module.ts`, `import { NgModule } from '@angular/core';
|
|
123
120
|
import { CommonModule } from '@angular/common';
|
|
124
121
|
import { VariableDeclareButtonComponent } from './variable-declare-button/variable-declare-button.component';
|
|
125
122
|
import { VariableDeclareViewComponent } from './variable-declare-view/variable-declare-view.component';
|
|
@@ -135,30 +132,30 @@ const COMPONENTS = [
|
|
|
135
132
|
exports: COMPONENTS
|
|
136
133
|
})
|
|
137
134
|
export class VariableDeclareModule {}`);
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
135
|
+
// create a module with components that get Angular exported and declared by variable
|
|
136
|
+
generateModule(tree, {
|
|
137
|
+
name: 'variable-spread-declare',
|
|
138
|
+
project: libName,
|
|
139
|
+
});
|
|
140
|
+
await (0, component_1.componentGenerator)(tree, {
|
|
141
|
+
name: 'variable-spread-declare-button',
|
|
142
|
+
project: libName,
|
|
143
|
+
path: `${libName}/src/lib/variable-spread-declare`,
|
|
144
|
+
module: 'variable-spread-declare',
|
|
145
|
+
});
|
|
146
|
+
await (0, component_1.componentGenerator)(tree, {
|
|
147
|
+
name: 'variable-spread-declare-view',
|
|
148
|
+
project: libName,
|
|
149
|
+
path: `${libName}/src/lib/variable-spread-declare`,
|
|
150
|
+
module: 'variable-spread-declare',
|
|
151
|
+
});
|
|
152
|
+
await (0, component_1.componentGenerator)(tree, {
|
|
153
|
+
name: 'variable-spread-declare-anotherview',
|
|
154
|
+
project: libName,
|
|
155
|
+
path: `${libName}/src/lib/variable-spread-declare`,
|
|
156
|
+
module: 'variable-spread-declare',
|
|
157
|
+
});
|
|
158
|
+
tree.write(`${libName}/src/lib/variable-spread-declare/variable-spread-declare.module.ts`, `import { NgModule } from '@angular/core';
|
|
162
159
|
import { CommonModule } from '@angular/common';
|
|
163
160
|
import { VariableSpreadDeclareButtonComponent } from './variable-spread-declare-button/variable-spread-declare-button.component';
|
|
164
161
|
import { VariableSpreadDeclareViewComponent } from './variable-spread-declare-view/variable-spread-declare-view.component';
|
|
@@ -174,24 +171,24 @@ const COMPONENTS = [
|
|
|
174
171
|
declarations: [...COMPONENTS, VariableSpreadDeclareAnotherviewComponent],
|
|
175
172
|
})
|
|
176
173
|
export class VariableSpreadDeclareModule {}`);
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
174
|
+
// create a module where declared components are pulled from a static member of the module
|
|
175
|
+
generateModule(tree, {
|
|
176
|
+
name: 'static-member-declarations',
|
|
177
|
+
project: libName,
|
|
178
|
+
});
|
|
179
|
+
await (0, component_1.componentGenerator)(tree, {
|
|
180
|
+
name: 'cmp1',
|
|
181
|
+
project: libName,
|
|
182
|
+
path: `${libName}/src/lib/static-member-declarations`,
|
|
183
|
+
module: 'static-member-declarations',
|
|
184
|
+
});
|
|
185
|
+
await (0, component_1.componentGenerator)(tree, {
|
|
186
|
+
name: 'cmp2',
|
|
187
|
+
project: libName,
|
|
188
|
+
path: `${libName}/src/lib/static-member-declarations`,
|
|
189
|
+
module: 'static-member-declarations',
|
|
190
|
+
});
|
|
191
|
+
tree.write(`${libName}/src/lib/static-member-declarations/static-member-declarations.module.ts`, `import { NgModule } from '@angular/core';
|
|
195
192
|
import { CommonModule } from '@angular/common';
|
|
196
193
|
import { Cmp1Component } from './cmp1/cmp1.component';
|
|
197
194
|
import { Cmp2Component } from './cmp2/cmp2.component';
|
|
@@ -204,34 +201,40 @@ import { Cmp2Component } from './cmp2/cmp2.component';
|
|
|
204
201
|
export class StaticMemberDeclarationsModule {
|
|
205
202
|
static readonly COMPONENTS = [Cmp1Component, Cmp2Component];
|
|
206
203
|
}`);
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
});
|
|
223
|
-
return tree;
|
|
204
|
+
// create another button in a nested subpath
|
|
205
|
+
generateModule(tree, {
|
|
206
|
+
name: 'nested',
|
|
207
|
+
project: libName,
|
|
208
|
+
path: `${libName}/src/lib`,
|
|
209
|
+
});
|
|
210
|
+
await (0, component_1.componentGenerator)(tree, {
|
|
211
|
+
name: 'nested-button',
|
|
212
|
+
project: libName,
|
|
213
|
+
module: 'nested',
|
|
214
|
+
path: `${libName}/src/lib/nested`,
|
|
215
|
+
});
|
|
216
|
+
await (0, component_1.componentGenerator)(tree, {
|
|
217
|
+
name: 'test-other',
|
|
218
|
+
project: libName,
|
|
224
219
|
});
|
|
220
|
+
return tree;
|
|
225
221
|
}
|
|
226
222
|
exports.createStorybookTestWorkspaceForLib = createStorybookTestWorkspaceForLib;
|
|
227
223
|
function addAngularPluginPeerDeps(tree) {
|
|
228
|
-
(0, devkit_1.updateJson)(tree, 'package.json', (json) => (
|
|
224
|
+
(0, devkit_1.updateJson)(tree, 'package.json', (json) => ({
|
|
225
|
+
...json,
|
|
226
|
+
devDependencies: {
|
|
227
|
+
...json.devDependencies,
|
|
228
|
+
'@angular-devkit/core': versions_1.angularDevkitVersion,
|
|
229
|
+
'@angular-devkit/schematics': versions_1.angularDevkitVersion,
|
|
230
|
+
'@schematics/angular': versions_1.angularDevkitVersion,
|
|
231
|
+
},
|
|
232
|
+
}));
|
|
229
233
|
}
|
|
230
234
|
function generateModule(tree, options) {
|
|
231
|
-
var _a;
|
|
232
235
|
const project = (0, devkit_1.readProjectConfiguration)(tree, options.project);
|
|
233
236
|
if (options.path === undefined) {
|
|
234
|
-
const sourceRoot =
|
|
237
|
+
const sourceRoot = project.sourceRoot ?? `${project.root}/src`;
|
|
235
238
|
const projectDirName = project.projectType === 'application' ? 'app' : 'lib';
|
|
236
239
|
options.path = `${sourceRoot}/${projectDirName}`;
|
|
237
240
|
}
|
|
@@ -16,7 +16,7 @@ function validateStandaloneOption(tree, standalone, angularVersion) {
|
|
|
16
16
|
if (!standalone) {
|
|
17
17
|
return;
|
|
18
18
|
}
|
|
19
|
-
const installedAngularVersion = angularVersion
|
|
19
|
+
const installedAngularVersion = angularVersion ?? (0, version_utils_1.getInstalledAngularVersionInfo)(tree).version;
|
|
20
20
|
if ((0, semver_1.lt)(installedAngularVersion, '14.1.0')) {
|
|
21
21
|
throw new Error((0, devkit_1.stripIndents) `The "standalone" option is only supported in Angular >= 14.1.0. You are currently using "${installedAngularVersion}".
|
|
22
22
|
You can resolve this error by removing the "standalone" option or by migrating to Angular 14.1.0.`);
|
|
@@ -7,15 +7,14 @@ const latestVersions = require("../../utils/versions");
|
|
|
7
7
|
const versions_1 = require("../../utils/versions");
|
|
8
8
|
const backward_compatible_versions_1 = require("../../utils/backward-compatible-versions");
|
|
9
9
|
function getInstalledAngularVersion(tree) {
|
|
10
|
-
var _a, _b;
|
|
11
10
|
const pkgJson = (0, devkit_1.readJson)(tree, 'package.json');
|
|
12
11
|
const installedAngularVersion = pkgJson.dependencies && pkgJson.dependencies['@angular/core'];
|
|
13
12
|
if (!installedAngularVersion ||
|
|
14
13
|
installedAngularVersion === 'latest' ||
|
|
15
14
|
installedAngularVersion === 'next') {
|
|
16
|
-
return (
|
|
15
|
+
return (0, semver_1.clean)(versions_1.angularVersion) ?? (0, semver_1.coerce)(versions_1.angularVersion).version;
|
|
17
16
|
}
|
|
18
|
-
return ((
|
|
17
|
+
return ((0, semver_1.clean)(installedAngularVersion) ?? (0, semver_1.coerce)(installedAngularVersion).version);
|
|
19
18
|
}
|
|
20
19
|
exports.getInstalledAngularVersion = getInstalledAngularVersion;
|
|
21
20
|
function getInstalledAngularMajorVersion(tree) {
|
|
@@ -31,9 +30,8 @@ function getInstalledAngularVersionInfo(tree) {
|
|
|
31
30
|
}
|
|
32
31
|
exports.getInstalledAngularVersionInfo = getInstalledAngularVersionInfo;
|
|
33
32
|
function getInstalledPackageVersion(tree, pkgName) {
|
|
34
|
-
var _a;
|
|
35
33
|
const { dependencies, devDependencies } = (0, devkit_1.readJson)(tree, 'package.json');
|
|
36
|
-
const version =
|
|
34
|
+
const version = dependencies?.[pkgName] ?? devDependencies?.[pkgName];
|
|
37
35
|
return version;
|
|
38
36
|
}
|
|
39
37
|
exports.getInstalledPackageVersion = getInstalledPackageVersion;
|
|
@@ -46,8 +44,8 @@ function addDependenciesToPackageJsonIfDontExist(tree, dependencies, devDependen
|
|
|
46
44
|
const packageJson = (0, devkit_1.readJson)(tree, packageJsonPath);
|
|
47
45
|
function filterExisting(deps) {
|
|
48
46
|
return Object.keys(deps)
|
|
49
|
-
.filter((d) =>
|
|
50
|
-
.reduce((acc, d) => (
|
|
47
|
+
.filter((d) => !packageJson.dependencies?.[d] && !packageJson.devDependencies?.[d])
|
|
48
|
+
.reduce((acc, d) => ({ ...acc, [d]: deps[d] }), {});
|
|
51
49
|
}
|
|
52
50
|
const depsToAdd = filterExisting(dependencies);
|
|
53
51
|
const devDepsToAdd = filterExisting(devDependencies);
|
|
@@ -3,7 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.normalizeOptions = void 0;
|
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
|
5
5
|
function normalizeOptions(tree, options) {
|
|
6
|
-
var _a, _b;
|
|
7
6
|
if (!(0, devkit_1.getProjects)(tree).has(options.project)) {
|
|
8
7
|
throw new Error(`Project '${options.project}' does not exist!`);
|
|
9
8
|
}
|
|
@@ -11,12 +10,16 @@ function normalizeOptions(tree, options) {
|
|
|
11
10
|
if (projectType !== 'application') {
|
|
12
11
|
throw new Error(`Web Worker can only be added to an application. Project '${options.project}' is a library.`);
|
|
13
12
|
}
|
|
14
|
-
const path =
|
|
13
|
+
const path = options.path ?? sourceRoot
|
|
15
14
|
? (0, devkit_1.joinPathFragments)(sourceRoot, 'app')
|
|
16
15
|
: (0, devkit_1.joinPathFragments)(root, 'src', 'app');
|
|
17
16
|
if (!tree.exists(path)) {
|
|
18
17
|
throw new Error(`Path '${options.path}' does not exist!`);
|
|
19
18
|
}
|
|
20
|
-
return
|
|
19
|
+
return {
|
|
20
|
+
...options,
|
|
21
|
+
path,
|
|
22
|
+
snippet: options.snippet ?? true,
|
|
23
|
+
};
|
|
21
24
|
}
|
|
22
25
|
exports.normalizeOptions = normalizeOptions;
|
|
@@ -1,37 +1,34 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.webWorkerGenerator = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
4
|
const devkit_1 = require("@nx/devkit");
|
|
6
5
|
const lib_1 = require("./lib");
|
|
7
6
|
const js_1 = require("@nx/js");
|
|
8
|
-
function webWorkerGenerator(tree, rawOptions) {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
(0,
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
}
|
|
34
|
-
});
|
|
7
|
+
async function webWorkerGenerator(tree, rawOptions) {
|
|
8
|
+
const options = (0, lib_1.normalizeOptions)(tree, rawOptions);
|
|
9
|
+
const workerNames = (0, devkit_1.names)(options.name);
|
|
10
|
+
const projectConfig = (0, devkit_1.readProjectConfiguration)(tree, options.project);
|
|
11
|
+
const substitutions = {
|
|
12
|
+
rootOffset: (0, devkit_1.offsetFromRoot)(projectConfig.root),
|
|
13
|
+
rootTsConfig: (0, js_1.getRelativePathToRootTsConfig)(tree, projectConfig.root),
|
|
14
|
+
name: workerNames.fileName,
|
|
15
|
+
tpl: '',
|
|
16
|
+
};
|
|
17
|
+
(0, devkit_1.generateFiles)(tree, (0, devkit_1.joinPathFragments)(__dirname, './files/worker'), options.path, substitutions);
|
|
18
|
+
(0, devkit_1.generateFiles)(tree, (0, devkit_1.joinPathFragments)(__dirname, './files/config'), projectConfig.root, substitutions);
|
|
19
|
+
if (options.snippet) {
|
|
20
|
+
(0, lib_1.addSnippet)(tree, workerNames.fileName, options.path);
|
|
21
|
+
}
|
|
22
|
+
projectConfig.targets['build'].options.webWorkerTsConfig ??=
|
|
23
|
+
(0, devkit_1.joinPathFragments)(projectConfig.root, 'tsconfig.worker.json');
|
|
24
|
+
if (projectConfig.targets['test']) {
|
|
25
|
+
projectConfig.targets['test'].options.webWorkerTsConfig ??=
|
|
26
|
+
(0, devkit_1.joinPathFragments)(projectConfig.root, 'tsconfig.worker.json');
|
|
27
|
+
}
|
|
28
|
+
(0, devkit_1.updateProjectConfiguration)(tree, options.project, projectConfig);
|
|
29
|
+
if (!options.skipFormat) {
|
|
30
|
+
await (0, devkit_1.formatFiles)(tree);
|
|
31
|
+
}
|
|
35
32
|
}
|
|
36
33
|
exports.webWorkerGenerator = webWorkerGenerator;
|
|
37
34
|
exports.default = webWorkerGenerator;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const tslib_1 = require("tslib");
|
|
4
3
|
const devkit_1 = require("@nx/devkit");
|
|
5
4
|
const executor_options_utils_1 = require("@nx/devkit/src/generators/executor-options-utils");
|
|
6
5
|
const executors = [
|
|
@@ -8,19 +7,17 @@ const executors = [
|
|
|
8
7
|
'@angular-devkit/build-angular:server',
|
|
9
8
|
'@nrwl/angular:webpack-browser',
|
|
10
9
|
];
|
|
11
|
-
function default_1(tree) {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
(0,
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
(0, devkit_1.updateProjectConfiguration)(tree, projectName, projectConfiguration);
|
|
21
|
-
});
|
|
10
|
+
async function default_1(tree) {
|
|
11
|
+
executors.forEach((executor) => {
|
|
12
|
+
(0, executor_options_utils_1.forEachExecutorOptions)(tree, executor, (_options, projectName, targetName, configurationName) => {
|
|
13
|
+
const projectConfiguration = (0, devkit_1.readProjectConfiguration)(tree, projectName);
|
|
14
|
+
const config = configurationName
|
|
15
|
+
? projectConfiguration.targets[targetName].configurations[configurationName]
|
|
16
|
+
: projectConfiguration.targets[targetName].options;
|
|
17
|
+
delete config.showCircularDependencies;
|
|
18
|
+
(0, devkit_1.updateProjectConfiguration)(tree, projectName, projectConfiguration);
|
|
22
19
|
});
|
|
23
|
-
yield (0, devkit_1.formatFiles)(tree);
|
|
24
20
|
});
|
|
21
|
+
await (0, devkit_1.formatFiles)(tree);
|
|
25
22
|
}
|
|
26
23
|
exports.default = default_1;
|
|
@@ -1,26 +1,22 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const tslib_1 = require("tslib");
|
|
4
3
|
const devkit_1 = require("@nx/devkit");
|
|
5
4
|
const angularCliVersion = '~14.0.0';
|
|
6
|
-
function default_1(tree) {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
json.devDependencies['@angular/cli'] = angularCliVersion;
|
|
13
|
-
shouldFormat = true;
|
|
14
|
-
}
|
|
15
|
-
else if ((_b = json.dependencies) === null || _b === void 0 ? void 0 : _b['@angular/cli']) {
|
|
16
|
-
json.dependencies['@angular/cli'] = angularCliVersion;
|
|
17
|
-
shouldFormat = true;
|
|
18
|
-
}
|
|
19
|
-
return json;
|
|
20
|
-
});
|
|
21
|
-
if (shouldFormat) {
|
|
22
|
-
yield (0, devkit_1.formatFiles)(tree);
|
|
5
|
+
async function default_1(tree) {
|
|
6
|
+
let shouldFormat = false;
|
|
7
|
+
(0, devkit_1.updateJson)(tree, 'package.json', (json) => {
|
|
8
|
+
if (json.devDependencies?.['@angular/cli']) {
|
|
9
|
+
json.devDependencies['@angular/cli'] = angularCliVersion;
|
|
10
|
+
shouldFormat = true;
|
|
23
11
|
}
|
|
12
|
+
else if (json.dependencies?.['@angular/cli']) {
|
|
13
|
+
json.dependencies['@angular/cli'] = angularCliVersion;
|
|
14
|
+
shouldFormat = true;
|
|
15
|
+
}
|
|
16
|
+
return json;
|
|
24
17
|
});
|
|
18
|
+
if (shouldFormat) {
|
|
19
|
+
await (0, devkit_1.formatFiles)(tree);
|
|
20
|
+
}
|
|
25
21
|
}
|
|
26
22
|
exports.default = default_1;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const tslib_1 = require("tslib");
|
|
4
3
|
const devkit_1 = require("@nx/devkit");
|
|
5
4
|
const path_1 = require("path");
|
|
6
5
|
const libraryExecutors = [
|
|
@@ -8,31 +7,28 @@ const libraryExecutors = [
|
|
|
8
7
|
'@nrwl/angular:ng-packagr-lite',
|
|
9
8
|
'@nrwl/angular:package',
|
|
10
9
|
];
|
|
11
|
-
function default_1(tree) {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
if (!Object.values((_a = project.targets) !== null && _a !== void 0 ? _a : {}).some((target) => libraryExecutors.includes(target.executor))) {
|
|
17
|
-
continue;
|
|
18
|
-
}
|
|
19
|
-
(0, devkit_1.visitNotIgnoredFiles)(tree, project.root, (filePath) => {
|
|
20
|
-
if ((0, path_1.basename)(filePath) !== 'package.json' ||
|
|
21
|
-
(0, devkit_1.normalizePath)(filePath) ===
|
|
22
|
-
(0, devkit_1.joinPathFragments)(project.root, 'package.json')) {
|
|
23
|
-
return;
|
|
24
|
-
}
|
|
25
|
-
const json = (0, devkit_1.readJson)(tree, filePath);
|
|
26
|
-
if (json.ngPackage) {
|
|
27
|
-
// Migrate ng-packagr config to an ng-packagr config file.
|
|
28
|
-
const configFilePath = (0, devkit_1.joinPathFragments)((0, path_1.dirname)(filePath), 'ng-package.json');
|
|
29
|
-
(0, devkit_1.writeJson)(tree, configFilePath, json.ngPackage);
|
|
30
|
-
}
|
|
31
|
-
// Delete package.json as it is no longer needed in APF 14.
|
|
32
|
-
tree.delete(filePath);
|
|
33
|
-
});
|
|
10
|
+
async function default_1(tree) {
|
|
11
|
+
const projects = (0, devkit_1.getProjects)(tree);
|
|
12
|
+
for (const [, project] of projects) {
|
|
13
|
+
if (!Object.values(project.targets ?? {}).some((target) => libraryExecutors.includes(target.executor))) {
|
|
14
|
+
continue;
|
|
34
15
|
}
|
|
35
|
-
|
|
36
|
-
|
|
16
|
+
(0, devkit_1.visitNotIgnoredFiles)(tree, project.root, (filePath) => {
|
|
17
|
+
if ((0, path_1.basename)(filePath) !== 'package.json' ||
|
|
18
|
+
(0, devkit_1.normalizePath)(filePath) ===
|
|
19
|
+
(0, devkit_1.joinPathFragments)(project.root, 'package.json')) {
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
const json = (0, devkit_1.readJson)(tree, filePath);
|
|
23
|
+
if (json.ngPackage) {
|
|
24
|
+
// Migrate ng-packagr config to an ng-packagr config file.
|
|
25
|
+
const configFilePath = (0, devkit_1.joinPathFragments)((0, path_1.dirname)(filePath), 'ng-package.json');
|
|
26
|
+
(0, devkit_1.writeJson)(tree, configFilePath, json.ngPackage);
|
|
27
|
+
}
|
|
28
|
+
// Delete package.json as it is no longer needed in APF 14.
|
|
29
|
+
tree.delete(filePath);
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
await (0, devkit_1.formatFiles)(tree);
|
|
37
33
|
}
|
|
38
34
|
exports.default = default_1;
|