@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,21 +1,24 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.scamDirectiveGenerator = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
4
|
const devkit_1 = require("@nx/devkit");
|
|
6
5
|
const directive_1 = require("../directive/directive");
|
|
7
6
|
const export_scam_1 = require("../utils/export-scam");
|
|
8
7
|
const lib_1 = require("./lib");
|
|
9
|
-
function scamDirectiveGenerator(tree, rawOptions) {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
8
|
+
async function scamDirectiveGenerator(tree, rawOptions) {
|
|
9
|
+
(0, lib_1.validateOptions)(tree, rawOptions);
|
|
10
|
+
const { inlineScam, ...directiveOptions } = rawOptions;
|
|
11
|
+
await (0, directive_1.directiveGenerator)(tree, {
|
|
12
|
+
...directiveOptions,
|
|
13
|
+
skipImport: true,
|
|
14
|
+
export: false,
|
|
15
|
+
standalone: false,
|
|
16
|
+
skipFormat: true,
|
|
18
17
|
});
|
|
18
|
+
const options = (0, lib_1.normalizeOptions)(tree, rawOptions);
|
|
19
|
+
(0, lib_1.convertDirectiveToScam)(tree, options);
|
|
20
|
+
(0, export_scam_1.exportScam)(tree, options);
|
|
21
|
+
await (0, devkit_1.formatFiles)(tree);
|
|
19
22
|
}
|
|
20
23
|
exports.scamDirectiveGenerator = scamDirectiveGenerator;
|
|
21
24
|
exports.default = scamDirectiveGenerator;
|
|
@@ -3,12 +3,20 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.normalizeOptions = void 0;
|
|
4
4
|
const path_1 = require("../../utils/path");
|
|
5
5
|
function normalizeOptions(tree, options) {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
const { directory, fileName, filePath, name, path } = (0, path_1.normalizeNameAndPaths)(tree, {
|
|
7
|
+
...options,
|
|
8
|
+
type: 'pipe',
|
|
9
|
+
});
|
|
10
|
+
return {
|
|
11
|
+
...options,
|
|
12
|
+
export: options.export ?? true,
|
|
13
|
+
flat: options.flat ?? true,
|
|
14
|
+
inlineScam: options.inlineScam ?? true,
|
|
15
|
+
directory,
|
|
9
16
|
fileName,
|
|
10
17
|
filePath,
|
|
11
18
|
name,
|
|
12
|
-
path
|
|
19
|
+
path,
|
|
20
|
+
};
|
|
13
21
|
}
|
|
14
22
|
exports.normalizeOptions = normalizeOptions;
|
|
@@ -1,21 +1,24 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.scamPipeGenerator = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
4
|
const devkit_1 = require("@nx/devkit");
|
|
6
5
|
const pipe_1 = require("../pipe/pipe");
|
|
7
6
|
const export_scam_1 = require("../utils/export-scam");
|
|
8
7
|
const lib_1 = require("./lib");
|
|
9
|
-
function scamPipeGenerator(tree, rawOptions) {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
8
|
+
async function scamPipeGenerator(tree, rawOptions) {
|
|
9
|
+
(0, lib_1.validateOptions)(tree, rawOptions);
|
|
10
|
+
const { inlineScam, ...pipeOptions } = rawOptions;
|
|
11
|
+
await (0, pipe_1.pipeGenerator)(tree, {
|
|
12
|
+
...pipeOptions,
|
|
13
|
+
skipImport: true,
|
|
14
|
+
export: false,
|
|
15
|
+
standalone: false,
|
|
16
|
+
skipFormat: true,
|
|
18
17
|
});
|
|
18
|
+
const options = (0, lib_1.normalizeOptions)(tree, rawOptions);
|
|
19
|
+
(0, lib_1.convertPipeToScam)(tree, options);
|
|
20
|
+
(0, export_scam_1.exportScam)(tree, options);
|
|
21
|
+
await (0, devkit_1.formatFiles)(tree);
|
|
19
22
|
}
|
|
20
23
|
exports.scamPipeGenerator = scamPipeGenerator;
|
|
21
24
|
exports.default = scamPipeGenerator;
|
|
@@ -1,37 +1,34 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.scamToStandalone = 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 version_utils_1 = require("../utils/version-utils");
|
|
8
7
|
const semver_1 = require("semver");
|
|
9
|
-
function scamToStandalone(tree, { component, project: projectName, skipFormat }) {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
throw new Error((0, devkit_1.stripIndents) `This generator is only supported with Angular >= 14.1.0. You are currently using ${installedAngularVersionInfo.version}.
|
|
8
|
+
async function scamToStandalone(tree, { component, project: projectName, skipFormat }) {
|
|
9
|
+
const installedAngularVersionInfo = (0, version_utils_1.getInstalledAngularVersionInfo)(tree);
|
|
10
|
+
if ((0, semver_1.lt)(installedAngularVersionInfo.version, '14.1.0')) {
|
|
11
|
+
throw new Error((0, devkit_1.stripIndents) `This generator is only supported with Angular >= 14.1.0. You are currently using ${installedAngularVersionInfo.version}.
|
|
14
12
|
You can resolve this error by migrating to Angular 14.1.0.`);
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
});
|
|
13
|
+
}
|
|
14
|
+
const projects = (0, devkit_1.getProjects)(tree);
|
|
15
|
+
let project = (0, lib_1.getTargetProject)(projectName, projects);
|
|
16
|
+
const normalizedComponentPath = (0, devkit_1.joinPathFragments)(project.root, component);
|
|
17
|
+
if (!tree.exists(normalizedComponentPath)) {
|
|
18
|
+
throw new Error(`The path provided to the component (${normalizedComponentPath}) does not exist. Please ensure the correct path has been provided.`);
|
|
19
|
+
}
|
|
20
|
+
const { componentFileContents, componentAST, componentName } = (0, lib_1.getComponentDataFromAST)(tree, normalizedComponentPath);
|
|
21
|
+
const isInlineScam = (0, lib_1.verifyIsInlineScam)(componentAST);
|
|
22
|
+
if (!isInlineScam) {
|
|
23
|
+
throw new Error('This generator currently only supports inline SCAMs. We could not find an accompanying NgModule within the component file, please ensure the SCAM provided is an inline scam.');
|
|
24
|
+
}
|
|
25
|
+
const { moduleNodes, exportsArray, importsArray, declarationsArray, providersArray, moduleName, } = (0, lib_1.getModuleMetadataFromAST)(componentAST, componentFileContents);
|
|
26
|
+
(0, lib_1.verifyModuleIsScam)(exportsArray, componentName, declarationsArray);
|
|
27
|
+
(0, lib_1.convertScamToStandalone)(componentAST, componentFileContents, importsArray, providersArray, moduleNodes, tree, normalizedComponentPath, componentName);
|
|
28
|
+
(0, lib_1.replaceModuleUsagesWithComponent)(tree, moduleName, componentName);
|
|
29
|
+
if (!skipFormat) {
|
|
30
|
+
await (0, devkit_1.formatFiles)(tree);
|
|
31
|
+
}
|
|
35
32
|
}
|
|
36
33
|
exports.scamToStandalone = scamToStandalone;
|
|
37
34
|
exports.default = scamToStandalone;
|
|
@@ -14,7 +14,7 @@ function addCypressOnErrorWorkaround(tree, schema) {
|
|
|
14
14
|
try {
|
|
15
15
|
e2eProject = (0, devkit_1.readProjectConfiguration)(tree, e2eProjectName);
|
|
16
16
|
}
|
|
17
|
-
catch
|
|
17
|
+
catch {
|
|
18
18
|
devkit_1.logger.warn((0, devkit_1.stripIndents) `Could not find an associated e2e project for ${schema.appName} with name ${e2eProjectName}.
|
|
19
19
|
If there is an associated e2e project for this application, and it uses Cypress, you will need to add a workaround to allow Cypress to test correctly.
|
|
20
20
|
An error will be thrown in the console when you serve the application, coming from styles.js. It is an error that can be safely ignored and will not reach production due to how production builds of Angular are created.
|
|
@@ -55,7 +55,10 @@ function addRemoteToStaticHost(tree, options, hostProject) {
|
|
|
55
55
|
}
|
|
56
56
|
function addRemoteToDynamicHost(tree, options, pathToMfManifest) {
|
|
57
57
|
(0, devkit_1.updateJson)(tree, pathToMfManifest, (manifest) => {
|
|
58
|
-
return
|
|
58
|
+
return {
|
|
59
|
+
...manifest,
|
|
60
|
+
[options.appName]: `http://localhost:${options.port}`,
|
|
61
|
+
};
|
|
59
62
|
});
|
|
60
63
|
}
|
|
61
64
|
// TODO(colum): future work: allow dev to pass to path to routing module
|
|
@@ -5,12 +5,18 @@ const devkit_1 = require("@nx/devkit");
|
|
|
5
5
|
function changeBuildTarget(host, options) {
|
|
6
6
|
const appConfig = (0, devkit_1.readProjectConfiguration)(host, options.appName);
|
|
7
7
|
appConfig.targets.build.executor = '@nx/angular:webpack-browser';
|
|
8
|
-
appConfig.targets.build.options =
|
|
8
|
+
appConfig.targets.build.options = {
|
|
9
|
+
...appConfig.targets.build.options,
|
|
10
|
+
customWebpackConfig: {
|
|
9
11
|
path: `${appConfig.root}/webpack.config.js`,
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
+
},
|
|
13
|
+
};
|
|
14
|
+
appConfig.targets.build.configurations.production = {
|
|
15
|
+
...appConfig.targets.build.configurations.production,
|
|
16
|
+
customWebpackConfig: {
|
|
12
17
|
path: `${appConfig.root}/webpack.prod.config.js`,
|
|
13
|
-
}
|
|
18
|
+
},
|
|
19
|
+
};
|
|
14
20
|
(0, devkit_1.updateProjectConfiguration)(host, options.appName, appConfig);
|
|
15
21
|
}
|
|
16
22
|
exports.changeBuildTarget = changeBuildTarget;
|
|
@@ -13,7 +13,7 @@ function generateWebpackConfig(tree, options, appRoot, remotesWithPorts) {
|
|
|
13
13
|
tmpl: '',
|
|
14
14
|
type: options.mfType,
|
|
15
15
|
name: options.appName,
|
|
16
|
-
remotes: remotesWithPorts
|
|
16
|
+
remotes: remotesWithPorts ?? [],
|
|
17
17
|
projectRoot: appRoot,
|
|
18
18
|
standalone: options.standalone,
|
|
19
19
|
});
|
|
@@ -3,7 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.getRemotesWithPorts = void 0;
|
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
|
5
5
|
function getRemotesWithPorts(host, options) {
|
|
6
|
-
var _a, _b, _c;
|
|
7
6
|
// If type is host and remotes supplied, check remotes exist
|
|
8
7
|
const remotesWithPort = [];
|
|
9
8
|
if (options.mfType === 'host' &&
|
|
@@ -13,7 +12,7 @@ function getRemotesWithPorts(host, options) {
|
|
|
13
12
|
const remoteConfig = (0, devkit_1.readProjectConfiguration)(host, remote);
|
|
14
13
|
remotesWithPort.push({
|
|
15
14
|
remoteName: remote,
|
|
16
|
-
port:
|
|
15
|
+
port: remoteConfig.targets['serve']?.options?.port ?? 4200,
|
|
17
16
|
});
|
|
18
17
|
}
|
|
19
18
|
}
|
|
@@ -3,7 +3,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.normalizeOptions = void 0;
|
|
4
4
|
const project_1 = require("../../utils/project");
|
|
5
5
|
function normalizeOptions(tree, options) {
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
return {
|
|
7
|
+
...options,
|
|
8
|
+
federationType: options.federationType ?? 'static',
|
|
9
|
+
prefix: options.prefix ?? (0, project_1.getProjectPrefix)(tree, options.appName),
|
|
10
|
+
};
|
|
8
11
|
}
|
|
9
12
|
exports.normalizeOptions = normalizeOptions;
|
|
@@ -5,6 +5,12 @@ const devkit_1 = require("@nx/devkit");
|
|
|
5
5
|
function updateTsConfigTarget(tree, schema) {
|
|
6
6
|
const { root } = (0, devkit_1.readProjectConfiguration)(tree, schema.appName);
|
|
7
7
|
// tsconfig.app.json
|
|
8
|
-
(0, devkit_1.updateJson)(tree, (0, devkit_1.joinPathFragments)(root, `tsconfig.app.json`), (json) => (
|
|
8
|
+
(0, devkit_1.updateJson)(tree, (0, devkit_1.joinPathFragments)(root, `tsconfig.app.json`), (json) => ({
|
|
9
|
+
...json,
|
|
10
|
+
compilerOptions: {
|
|
11
|
+
...json.compilerOptions,
|
|
12
|
+
target: 'ES2020',
|
|
13
|
+
},
|
|
14
|
+
}));
|
|
9
15
|
}
|
|
10
16
|
exports.updateTsConfigTarget = updateTsConfigTarget;
|
|
@@ -3,7 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.setupHostIfDynamic = void 0;
|
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
|
5
5
|
function setupHostIfDynamic(tree, options) {
|
|
6
|
-
var _a;
|
|
7
6
|
if (options.federationType === 'static') {
|
|
8
7
|
return;
|
|
9
8
|
}
|
|
@@ -16,7 +15,7 @@ function setupHostIfDynamic(tree, options) {
|
|
|
16
15
|
if (tree.exists(pathToProdWebpackConfig)) {
|
|
17
16
|
tree.delete(pathToProdWebpackConfig);
|
|
18
17
|
}
|
|
19
|
-
|
|
18
|
+
delete project.targets.build.configurations.production?.customWebpackConfig;
|
|
20
19
|
(0, devkit_1.updateProjectConfiguration)(tree, options.appName, project);
|
|
21
20
|
}
|
|
22
21
|
exports.setupHostIfDynamic = setupHostIfDynamic;
|
|
@@ -3,11 +3,18 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.setupServeTarget = void 0;
|
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
|
5
5
|
function setupServeTarget(host, options) {
|
|
6
|
-
var _a, _b;
|
|
7
6
|
const appConfig = (0, devkit_1.readProjectConfiguration)(host, options.appName);
|
|
8
|
-
appConfig.targets['serve'] =
|
|
7
|
+
appConfig.targets['serve'] = {
|
|
8
|
+
...appConfig.targets['serve'],
|
|
9
|
+
executor: options.mfType === 'host'
|
|
9
10
|
? '@nx/angular:module-federation-dev-server'
|
|
10
|
-
: '@nx/angular:webpack-dev-server',
|
|
11
|
+
: '@nx/angular:webpack-dev-server',
|
|
12
|
+
options: {
|
|
13
|
+
...appConfig.targets['serve'].options,
|
|
14
|
+
port: options.port ?? undefined,
|
|
15
|
+
publicHost: `http://localhost:${options.port ?? 4200}`,
|
|
16
|
+
},
|
|
17
|
+
};
|
|
11
18
|
if (options.mfType === 'remote') {
|
|
12
19
|
appConfig.targets['serve-static'] = {
|
|
13
20
|
executor: '@nx/web:file-server',
|
|
@@ -1,46 +1,43 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.setupMf = 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 version_utils_1 = require("../utils/version-utils");
|
|
8
7
|
const versions_1 = require("../../utils/versions");
|
|
9
8
|
const semver_1 = require("semver");
|
|
10
|
-
function setupMf(tree, rawOptions) {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
return installTask;
|
|
43
|
-
});
|
|
9
|
+
async function setupMf(tree, rawOptions) {
|
|
10
|
+
const installedAngularInfo = (0, version_utils_1.getInstalledAngularVersionInfo)(tree);
|
|
11
|
+
if ((0, semver_1.lt)(installedAngularInfo.version, '14.1.0') && rawOptions.standalone) {
|
|
12
|
+
throw new Error(`The --standalone flag is not supported in your current version of Angular (${installedAngularInfo.version}). Please update to a version of Angular that supports Standalone Components (>= 14.1.0).`);
|
|
13
|
+
}
|
|
14
|
+
const options = (0, lib_1.normalizeOptions)(tree, rawOptions);
|
|
15
|
+
const projectConfig = (0, devkit_1.readProjectConfiguration)(tree, options.appName);
|
|
16
|
+
let installTask = () => { };
|
|
17
|
+
if (options.mfType === 'remote') {
|
|
18
|
+
(0, lib_1.addRemoteToHost)(tree, options);
|
|
19
|
+
(0, lib_1.addRemoteEntry)(tree, options, projectConfig.root);
|
|
20
|
+
(0, lib_1.removeDeadCodeFromRemote)(tree, options);
|
|
21
|
+
installTask = (0, devkit_1.addDependenciesToPackageJson)(tree, {}, { '@nx/web': versions_1.nxVersion });
|
|
22
|
+
}
|
|
23
|
+
const remotesWithPorts = (0, lib_1.getRemotesWithPorts)(tree, options);
|
|
24
|
+
(0, lib_1.generateWebpackConfig)(tree, options, projectConfig.root, remotesWithPorts);
|
|
25
|
+
(0, lib_1.changeBuildTarget)(tree, options);
|
|
26
|
+
(0, lib_1.updateTsConfigTarget)(tree, options);
|
|
27
|
+
(0, lib_1.setupServeTarget)(tree, options);
|
|
28
|
+
(0, lib_1.fixBootstrap)(tree, projectConfig.root, options);
|
|
29
|
+
if (options.mfType === 'host') {
|
|
30
|
+
(0, lib_1.setupHostIfDynamic)(tree, options);
|
|
31
|
+
(0, lib_1.updateHostAppRoutes)(tree, options);
|
|
32
|
+
}
|
|
33
|
+
if (!options.skipE2E) {
|
|
34
|
+
(0, lib_1.addCypressOnErrorWorkaround)(tree, options);
|
|
35
|
+
}
|
|
36
|
+
// format files
|
|
37
|
+
if (!options.skipFormat) {
|
|
38
|
+
await (0, devkit_1.formatFiles)(tree);
|
|
39
|
+
}
|
|
40
|
+
return installTask;
|
|
44
41
|
}
|
|
45
42
|
exports.setupMf = setupMf;
|
|
46
43
|
exports.default = setupMf;
|
|
@@ -10,18 +10,21 @@ function generateSSRFiles(tree, schema) {
|
|
|
10
10
|
const projectRoot = projectConfig.root;
|
|
11
11
|
const browserBundleOutputPath = projectConfig.targets.build.options.outputPath;
|
|
12
12
|
const pathToFiles = (0, devkit_1.joinPathFragments)(__dirname, '..', 'files');
|
|
13
|
-
(0, devkit_1.generateFiles)(tree, (0, path_1.join)(pathToFiles, 'base'), projectRoot,
|
|
13
|
+
(0, devkit_1.generateFiles)(tree, (0, path_1.join)(pathToFiles, 'base'), projectRoot, {
|
|
14
|
+
...schema,
|
|
15
|
+
tpl: '',
|
|
16
|
+
});
|
|
14
17
|
if (schema.standalone) {
|
|
15
|
-
(0, devkit_1.generateFiles)(tree, (0, devkit_1.joinPathFragments)(pathToFiles, 'standalone'), projectRoot,
|
|
18
|
+
(0, devkit_1.generateFiles)(tree, (0, devkit_1.joinPathFragments)(pathToFiles, 'standalone'), projectRoot, { ...schema, browserBundleOutputPath, tpl: '' });
|
|
16
19
|
}
|
|
17
20
|
else {
|
|
18
|
-
(0, devkit_1.generateFiles)(tree, (0, devkit_1.joinPathFragments)(pathToFiles, 'ngmodule', 'base'), projectRoot,
|
|
21
|
+
(0, devkit_1.generateFiles)(tree, (0, devkit_1.joinPathFragments)(pathToFiles, 'ngmodule', 'base'), projectRoot, { ...schema, browserBundleOutputPath, tpl: '' });
|
|
19
22
|
const { major: angularMajorVersion, version: angularVersion } = (0, version_utils_1.getInstalledAngularVersionInfo)(tree);
|
|
20
23
|
if (angularMajorVersion < 15) {
|
|
21
|
-
(0, devkit_1.generateFiles)(tree, (0, devkit_1.joinPathFragments)(pathToFiles, 'ngmodule', 'v14'), projectRoot,
|
|
24
|
+
(0, devkit_1.generateFiles)(tree, (0, devkit_1.joinPathFragments)(pathToFiles, 'ngmodule', 'v14'), projectRoot, { ...schema, browserBundleOutputPath, tpl: '' });
|
|
22
25
|
}
|
|
23
26
|
if ((0, semver_1.lt)(angularVersion, '15.2.0')) {
|
|
24
|
-
(0, devkit_1.generateFiles)(tree, (0, devkit_1.joinPathFragments)(pathToFiles, 'ngmodule', 'pre-v15-2'), projectRoot,
|
|
27
|
+
(0, devkit_1.generateFiles)(tree, (0, devkit_1.joinPathFragments)(pathToFiles, 'ngmodule', 'pre-v15-2'), projectRoot, { ...schema, browserBundleOutputPath, tpl: '' });
|
|
25
28
|
}
|
|
26
29
|
}
|
|
27
30
|
}
|
|
@@ -3,19 +3,18 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.normalizeOptions = void 0;
|
|
4
4
|
const ast_utils_1 = require("../../../utils/nx-devkit/ast-utils");
|
|
5
5
|
function normalizeOptions(tree, options) {
|
|
6
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
7
6
|
const isStandaloneApp = (0, ast_utils_1.isNgStandaloneApp)(tree, options.project);
|
|
8
7
|
return {
|
|
9
8
|
project: options.project,
|
|
10
|
-
appId:
|
|
11
|
-
main:
|
|
12
|
-
serverFileName:
|
|
13
|
-
serverPort:
|
|
14
|
-
rootModuleFileName:
|
|
15
|
-
rootModuleClassName:
|
|
16
|
-
skipFormat:
|
|
17
|
-
standalone:
|
|
18
|
-
hydration:
|
|
9
|
+
appId: options.appId ?? 'serverApp',
|
|
10
|
+
main: options.main ?? 'main.server.ts',
|
|
11
|
+
serverFileName: options.serverFileName ?? 'server.ts',
|
|
12
|
+
serverPort: options.serverPort ?? 4000,
|
|
13
|
+
rootModuleFileName: options.rootModuleFileName ?? 'app.server.module.ts',
|
|
14
|
+
rootModuleClassName: options.rootModuleClassName ?? 'AppServerModule',
|
|
15
|
+
skipFormat: options.skipFormat ?? false,
|
|
16
|
+
standalone: options.standalone ?? isStandaloneApp,
|
|
17
|
+
hydration: options.hydration ?? false,
|
|
19
18
|
};
|
|
20
19
|
}
|
|
21
20
|
exports.normalizeOptions = normalizeOptions;
|
|
@@ -3,7 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.updateProjectConfig = void 0;
|
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
|
5
5
|
function updateProjectConfig(tree, schema) {
|
|
6
|
-
var _a;
|
|
7
6
|
let projectConfig = (0, devkit_1.readProjectConfiguration)(tree, schema.project);
|
|
8
7
|
const buildTarget = projectConfig.targets.build;
|
|
9
8
|
const baseOutputPath = buildTarget.options.outputPath;
|
|
@@ -18,7 +17,12 @@ function updateProjectConfig(tree, schema) {
|
|
|
18
17
|
projectConfig.targets.server = {
|
|
19
18
|
dependsOn: ['build'],
|
|
20
19
|
executor: '@angular-devkit/build-angular:server',
|
|
21
|
-
options:
|
|
20
|
+
options: {
|
|
21
|
+
outputPath: (0, devkit_1.joinPathFragments)(baseOutputPath, 'server'),
|
|
22
|
+
main: (0, devkit_1.joinPathFragments)(projectConfig.root, schema.serverFileName),
|
|
23
|
+
tsConfig: (0, devkit_1.joinPathFragments)(projectConfig.root, 'tsconfig.server.json'),
|
|
24
|
+
...(buildTarget.options ? getServerOptions(buildTarget.options) : {}),
|
|
25
|
+
},
|
|
22
26
|
configurations,
|
|
23
27
|
defaultConfiguration: 'production',
|
|
24
28
|
};
|
|
@@ -55,7 +59,7 @@ function updateProjectConfig(tree, schema) {
|
|
|
55
59
|
};
|
|
56
60
|
(0, devkit_1.updateProjectConfiguration)(tree, schema.project, projectConfig);
|
|
57
61
|
const nxJson = (0, devkit_1.readNxJson)(tree);
|
|
58
|
-
if (
|
|
62
|
+
if (nxJson.tasksRunnerOptions?.default &&
|
|
59
63
|
!nxJson.tasksRunnerOptions.default.options.cacheableOperations.includes('server')) {
|
|
60
64
|
nxJson.tasksRunnerOptions.default.options.cacheableOperations = [
|
|
61
65
|
...nxJson.tasksRunnerOptions.default.options.cacheableOperations,
|
|
@@ -67,20 +71,20 @@ function updateProjectConfig(tree, schema) {
|
|
|
67
71
|
exports.updateProjectConfig = updateProjectConfig;
|
|
68
72
|
function getServerOptions(options = {}) {
|
|
69
73
|
return {
|
|
70
|
-
buildOptimizer: options
|
|
71
|
-
outputHashing:
|
|
74
|
+
buildOptimizer: options?.buildOptimizer,
|
|
75
|
+
outputHashing: options?.outputHashing === 'all'
|
|
72
76
|
? 'media'
|
|
73
|
-
: options
|
|
74
|
-
fileReplacements: options
|
|
75
|
-
optimization:
|
|
76
|
-
sourceMap: options
|
|
77
|
-
stylePreprocessorOptions: options
|
|
78
|
-
resourcesOutputPath: options
|
|
79
|
-
deployUrl: options
|
|
80
|
-
i18nMissingTranslation: options
|
|
81
|
-
preserveSymlinks: options
|
|
82
|
-
extractLicenses: options
|
|
83
|
-
inlineStyleLanguage: options
|
|
84
|
-
vendorChunk: options
|
|
77
|
+
: options?.outputHashing,
|
|
78
|
+
fileReplacements: options?.fileReplacements,
|
|
79
|
+
optimization: options?.optimization === undefined ? undefined : !!options?.optimization,
|
|
80
|
+
sourceMap: options?.sourceMap,
|
|
81
|
+
stylePreprocessorOptions: options?.stylePreprocessorOptions,
|
|
82
|
+
resourcesOutputPath: options?.resourcesOutputPath,
|
|
83
|
+
deployUrl: options?.deployUrl,
|
|
84
|
+
i18nMissingTranslation: options?.i18nMissingTranslation,
|
|
85
|
+
preserveSymlinks: options?.preserveSymlinks,
|
|
86
|
+
extractLicenses: options?.extractLicenses,
|
|
87
|
+
inlineStyleLanguage: options?.inlineStyleLanguage,
|
|
88
|
+
vendorChunk: options?.vendorChunk,
|
|
85
89
|
};
|
|
86
90
|
}
|
|
@@ -1,37 +1,36 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.setupSsr = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
4
|
const devkit_1 = require("@nx/devkit");
|
|
6
5
|
const version_utils_1 = require("../utils/version-utils");
|
|
7
6
|
const lib_1 = require("./lib");
|
|
8
|
-
function setupSsr(tree, schema) {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
(0, lib_1.
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
if (!options.skipFormat) {
|
|
29
|
-
yield (0, devkit_1.formatFiles)(tree);
|
|
30
|
-
}
|
|
31
|
-
return () => {
|
|
32
|
-
(0, devkit_1.installPackagesTask)(tree);
|
|
33
|
-
};
|
|
7
|
+
async function setupSsr(tree, schema) {
|
|
8
|
+
(0, lib_1.validateOptions)(tree, schema);
|
|
9
|
+
const options = (0, lib_1.normalizeOptions)(tree, schema);
|
|
10
|
+
(0, lib_1.updateProjectConfig)(tree, options);
|
|
11
|
+
(0, lib_1.generateSSRFiles)(tree, options);
|
|
12
|
+
if (!options.standalone) {
|
|
13
|
+
(0, lib_1.updateAppModule)(tree, options);
|
|
14
|
+
}
|
|
15
|
+
if (options.hydration) {
|
|
16
|
+
(0, lib_1.addHydration)(tree, options);
|
|
17
|
+
}
|
|
18
|
+
const pkgVersions = (0, version_utils_1.versions)(tree);
|
|
19
|
+
(0, devkit_1.addDependenciesToPackageJson)(tree, {
|
|
20
|
+
'@nguniversal/express-engine': (0, version_utils_1.getInstalledPackageVersionInfo)(tree, '@nguniversal/express-engine')
|
|
21
|
+
?.version ?? pkgVersions.ngUniversalVersion,
|
|
22
|
+
'@angular/platform-server': (0, version_utils_1.getInstalledPackageVersionInfo)(tree, '@angular/platform-server')
|
|
23
|
+
?.version ?? pkgVersions.angularVersion,
|
|
24
|
+
}, {
|
|
25
|
+
'@nguniversal/builders': (0, version_utils_1.getInstalledPackageVersionInfo)(tree, '@nguniversal/builders')
|
|
26
|
+
?.version ?? pkgVersions.ngUniversalVersion,
|
|
34
27
|
});
|
|
28
|
+
if (!options.skipFormat) {
|
|
29
|
+
await (0, devkit_1.formatFiles)(tree);
|
|
30
|
+
}
|
|
31
|
+
return () => {
|
|
32
|
+
(0, devkit_1.installPackagesTask)(tree);
|
|
33
|
+
};
|
|
35
34
|
}
|
|
36
35
|
exports.setupSsr = setupSsr;
|
|
37
36
|
exports.default = setupSsr;
|
|
@@ -3,8 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.addTailwindConfigPathToProject = void 0;
|
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
|
5
5
|
function addTailwindConfigPathToProject(tree, options, project) {
|
|
6
|
-
|
|
7
|
-
const buildTarget = (_a = project.targets) === null || _a === void 0 ? void 0 : _a[options.buildTarget];
|
|
6
|
+
const buildTarget = project.targets?.[options.buildTarget];
|
|
8
7
|
if (!buildTarget) {
|
|
9
8
|
throw new Error((0, devkit_1.stripIndents) `The target "${options.buildTarget}" was not found for project "${options.project}".
|
|
10
9
|
If you are using a different build target, please provide it using the "--buildTarget" option.
|
|
@@ -22,12 +21,15 @@ function addTailwindConfigPathToProject(tree, options, project) {
|
|
|
22
21
|
.map((e) => `"${e}"`)
|
|
23
22
|
.join(', ')}.`);
|
|
24
23
|
}
|
|
25
|
-
if (
|
|
24
|
+
if (buildTarget.options?.tailwindConfig &&
|
|
26
25
|
tree.exists(buildTarget.options.tailwindConfig)) {
|
|
27
26
|
throw new Error((0, devkit_1.stripIndents) `The "${buildTarget.options.tailwindConfig}" file is already configured for the project "${options.project}". Are you sure this is the right project to set up Tailwind?
|
|
28
27
|
If you are sure, you can remove the configuration and re-run the generator.`);
|
|
29
28
|
}
|
|
30
|
-
buildTarget.options =
|
|
29
|
+
buildTarget.options = {
|
|
30
|
+
...buildTarget.options,
|
|
31
|
+
tailwindConfig: (0, devkit_1.joinPathFragments)(project.root, 'tailwind.config.js'),
|
|
32
|
+
};
|
|
31
33
|
(0, devkit_1.updateProjectConfiguration)(tree, options.project, project);
|
|
32
34
|
}
|
|
33
35
|
exports.addTailwindConfigPathToProject = addTailwindConfigPathToProject;
|