@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.AngularEslintLintMigrator = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
4
|
const devkit_1 = require("@nx/devkit");
|
|
6
5
|
const linter_1 = require("@nx/linter");
|
|
7
6
|
const path_1 = require("path");
|
|
@@ -11,13 +10,13 @@ class AngularEslintLintMigrator extends builder_migrator_1.BuilderMigrator {
|
|
|
11
10
|
super(tree, '@angular-eslint/builder:lint', 'eslint', project, projectConfig, logger);
|
|
12
11
|
}
|
|
13
12
|
migrate() {
|
|
14
|
-
var _a, _b;
|
|
15
13
|
if (this.skipMigration) {
|
|
16
14
|
return;
|
|
17
15
|
}
|
|
18
16
|
for (const [name, target] of this.targets) {
|
|
19
17
|
this.oldEsLintConfigPath =
|
|
20
|
-
|
|
18
|
+
target.options?.eslintConfig ??
|
|
19
|
+
(0, devkit_1.joinPathFragments)(this.project.oldRoot, '.eslintrc.json');
|
|
21
20
|
this.newEsLintConfigPath = this.convertRootPath(this.oldEsLintConfigPath);
|
|
22
21
|
this.moveProjectRootFile(this.oldEsLintConfigPath);
|
|
23
22
|
this.updateTargetConfiguration(name, target);
|
|
@@ -34,42 +33,42 @@ class AngularEslintLintMigrator extends builder_migrator_1.BuilderMigrator {
|
|
|
34
33
|
}
|
|
35
34
|
}
|
|
36
35
|
}
|
|
37
|
-
updateTargetConfiguration(targetName, target) {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
target.options.eslintConfig
|
|
49
|
-
|
|
50
|
-
target.options.lintFilePatterns
|
|
51
|
-
target.options.lintFilePatterns
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
target.options.hasTypeAwareRules = true;
|
|
70
|
-
}
|
|
36
|
+
async updateTargetConfiguration(targetName, target) {
|
|
37
|
+
target.executor = '@nx/linter:eslint';
|
|
38
|
+
if (!target.options) {
|
|
39
|
+
this.logger.warn(`The target "${targetName}" is not specifying any options. Skipping updating the target configuration.`);
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
const existEsLintConfigPath = this.tree.exists(this.newEsLintConfigPath);
|
|
43
|
+
if (!existEsLintConfigPath) {
|
|
44
|
+
this.logger.warn(`The ESLint config file "${this.oldEsLintConfigPath}" could not be found. Skipping updating the file.`);
|
|
45
|
+
}
|
|
46
|
+
target.options.eslintConfig =
|
|
47
|
+
target.options.eslintConfig && this.newEsLintConfigPath;
|
|
48
|
+
target.options.lintFilePatterns =
|
|
49
|
+
target.options.lintFilePatterns &&
|
|
50
|
+
target.options.lintFilePatterns.map((pattern) => {
|
|
51
|
+
// replace the old source root with the new root, we want to lint all
|
|
52
|
+
// matching files in the project, not just the ones in the source root
|
|
53
|
+
if (pattern.startsWith(this.project.oldSourceRoot)) {
|
|
54
|
+
return (0, devkit_1.joinPathFragments)(this.project.newRoot, pattern.replace(this.project.oldSourceRoot, ''));
|
|
55
|
+
}
|
|
56
|
+
// replace the old root with the new root
|
|
57
|
+
if (pattern.startsWith(this.project.oldRoot)) {
|
|
58
|
+
return (0, devkit_1.joinPathFragments)(this.project.newRoot, pattern.replace(this.project.oldRoot, ''));
|
|
59
|
+
}
|
|
60
|
+
// do nothing, warn about the pattern
|
|
61
|
+
this.logger.warn(`The lint file pattern "${pattern}" specified in the "${targetName}" target is not contained in the project root or source root. The pattern will not be updated.`);
|
|
62
|
+
return pattern;
|
|
63
|
+
});
|
|
64
|
+
if (existEsLintConfigPath) {
|
|
65
|
+
const eslintConfig = (0, devkit_1.readJson)(this.tree, this.newEsLintConfigPath);
|
|
66
|
+
if ((0, linter_1.hasRulesRequiringTypeChecking)(eslintConfig)) {
|
|
67
|
+
target.options.hasTypeAwareRules = true;
|
|
71
68
|
}
|
|
72
|
-
|
|
69
|
+
}
|
|
70
|
+
(0, devkit_1.updateProjectConfiguration)(this.tree, this.project.name, {
|
|
71
|
+
...this.projectConfig,
|
|
73
72
|
});
|
|
74
73
|
}
|
|
75
74
|
updateEsLintConfig() {
|
|
@@ -77,7 +76,6 @@ class AngularEslintLintMigrator extends builder_migrator_1.BuilderMigrator {
|
|
|
77
76
|
return;
|
|
78
77
|
}
|
|
79
78
|
(0, devkit_1.updateJson)(this.tree, this.newEsLintConfigPath, (json) => {
|
|
80
|
-
var _a;
|
|
81
79
|
delete json.root;
|
|
82
80
|
json.ignorePatterns = ['!**/*'];
|
|
83
81
|
const rootEsLintConfigRelativePath = (0, devkit_1.joinPathFragments)((0, devkit_1.offsetFromRoot)(this.projectConfig.root), '.eslintrc.json');
|
|
@@ -91,9 +89,8 @@ class AngularEslintLintMigrator extends builder_migrator_1.BuilderMigrator {
|
|
|
91
89
|
else {
|
|
92
90
|
json.extends = rootEsLintConfigRelativePath;
|
|
93
91
|
}
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
if (!((_a = override.parserOptions) === null || _a === void 0 ? void 0 : _a.project)) {
|
|
92
|
+
json.overrides?.forEach((override) => {
|
|
93
|
+
if (!override.parserOptions?.project) {
|
|
97
94
|
return;
|
|
98
95
|
}
|
|
99
96
|
override.parserOptions.project = [
|
|
@@ -33,8 +33,7 @@ class BuilderMigrator extends migrator_1.Migrator {
|
|
|
33
33
|
return this.targets.size > 0;
|
|
34
34
|
}
|
|
35
35
|
collectBuilderTargets() {
|
|
36
|
-
|
|
37
|
-
for (const [name, target] of Object.entries((_a = this.projectConfig.targets) !== null && _a !== void 0 ? _a : {})) {
|
|
36
|
+
for (const [name, target] of Object.entries(this.projectConfig.targets ?? {})) {
|
|
38
37
|
if (target.executor === this.builderName) {
|
|
39
38
|
this.targets.set(name, target);
|
|
40
39
|
}
|
|
@@ -15,11 +15,11 @@ class Migrator {
|
|
|
15
15
|
return this.convertSourceRootPath(asset);
|
|
16
16
|
}
|
|
17
17
|
else {
|
|
18
|
-
return
|
|
18
|
+
return { ...asset, input: this.convertSourceRootPath(asset.input) };
|
|
19
19
|
}
|
|
20
20
|
}
|
|
21
21
|
convertRootPath(originalPath) {
|
|
22
|
-
return
|
|
22
|
+
return originalPath?.startsWith(this.project.oldRoot)
|
|
23
23
|
? (0, devkit_1.joinPathFragments)(this.project.newRoot, originalPath.replace(this.project.oldRoot, ''))
|
|
24
24
|
: originalPath;
|
|
25
25
|
}
|
|
@@ -58,16 +58,14 @@ class Migrator {
|
|
|
58
58
|
}
|
|
59
59
|
// TODO(leo): This should be moved to BuilderMigrator once everything is split into builder migrators.
|
|
60
60
|
updateCacheableOperations(targetNames) {
|
|
61
|
-
var _a;
|
|
62
61
|
if (!targetNames.length) {
|
|
63
62
|
return;
|
|
64
63
|
}
|
|
65
64
|
const nxJson = (0, devkit_1.readNxJson)(this.tree);
|
|
66
|
-
Object.keys(
|
|
67
|
-
var _a;
|
|
65
|
+
Object.keys(nxJson.tasksRunnerOptions ?? {}).forEach((taskRunnerName) => {
|
|
68
66
|
const taskRunner = nxJson.tasksRunnerOptions[taskRunnerName];
|
|
69
67
|
taskRunner.options.cacheableOperations = Array.from(new Set([
|
|
70
|
-
...(
|
|
68
|
+
...(taskRunner.options.cacheableOperations ?? []),
|
|
71
69
|
...targetNames,
|
|
72
70
|
]));
|
|
73
71
|
});
|
|
@@ -76,26 +74,24 @@ class Migrator {
|
|
|
76
74
|
// TODO(leo): This should be moved to BuilderMigrator once everything is split into builder migrators.
|
|
77
75
|
updateTsConfigFile(tsConfigPath, rootTsConfigFile, projectOffsetFromRoot) {
|
|
78
76
|
(0, devkit_1.updateJson)(this.tree, tsConfigPath, (json) => {
|
|
79
|
-
var _a;
|
|
80
77
|
json.extends = `${projectOffsetFromRoot}${rootTsConfigFile}`;
|
|
81
|
-
json.compilerOptions =
|
|
78
|
+
json.compilerOptions = json.compilerOptions ?? {};
|
|
82
79
|
json.compilerOptions.outDir = `${projectOffsetFromRoot}dist/out-tsc`;
|
|
83
80
|
return json;
|
|
84
81
|
});
|
|
85
82
|
}
|
|
86
83
|
convertSourceRootPath(originalPath) {
|
|
87
|
-
return
|
|
84
|
+
return originalPath?.startsWith(this.project.oldSourceRoot)
|
|
88
85
|
? (0, devkit_1.joinPathFragments)(this.project.newSourceRoot, originalPath.replace(this.project.oldSourceRoot, ''))
|
|
89
86
|
: originalPath;
|
|
90
87
|
}
|
|
91
88
|
getTargetValuesForOption(target, optionPath) {
|
|
92
|
-
var _a;
|
|
93
89
|
const values = new Set();
|
|
94
90
|
const value = this.getValueForOption(target.options, optionPath);
|
|
95
91
|
if (value) {
|
|
96
92
|
values.add(value);
|
|
97
93
|
}
|
|
98
|
-
for (const configuration of Object.values(
|
|
94
|
+
for (const configuration of Object.values(target.configurations ?? {})) {
|
|
99
95
|
const value = this.getValueForOption(configuration, optionPath);
|
|
100
96
|
if (value) {
|
|
101
97
|
values.add(value);
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.AppMigrator = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
4
|
const devkit_1 = require("@nx/devkit");
|
|
6
5
|
const js_1 = require("@nx/js");
|
|
7
6
|
const path_1 = require("path");
|
|
@@ -37,35 +36,28 @@ class AppMigrator extends project_migrator_1.ProjectMigrator {
|
|
|
37
36
|
? Object.keys(eslintBuilderMigrator.targets)[0]
|
|
38
37
|
: undefined);
|
|
39
38
|
}
|
|
40
|
-
migrate() {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
for (const builderMigrator of (_a = this.builderMigrators) !== null && _a !== void 0 ? _a : []) {
|
|
55
|
-
yield builderMigrator.migrate();
|
|
56
|
-
}
|
|
57
|
-
this.updateTsConfigs();
|
|
58
|
-
this.setCacheableOperations();
|
|
59
|
-
});
|
|
39
|
+
async migrate() {
|
|
40
|
+
if (this.skipMigration === true) {
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
await super.migrate();
|
|
44
|
+
this.updateProjectConfiguration();
|
|
45
|
+
await this.e2eMigrator.migrate();
|
|
46
|
+
this.moveProjectFiles();
|
|
47
|
+
this.updateProjectConfigurationTargets();
|
|
48
|
+
for (const builderMigrator of this.builderMigrators ?? []) {
|
|
49
|
+
await builderMigrator.migrate();
|
|
50
|
+
}
|
|
51
|
+
this.updateTsConfigs();
|
|
52
|
+
this.setCacheableOperations();
|
|
60
53
|
}
|
|
61
54
|
validate() {
|
|
62
|
-
var _a, _b, _c;
|
|
63
55
|
const errors = [
|
|
64
|
-
...(
|
|
65
|
-
...(
|
|
56
|
+
...(super.validate() ?? []),
|
|
57
|
+
...(this.e2eMigrator.validate() ?? []),
|
|
66
58
|
];
|
|
67
59
|
for (const builderMigrator of this.builderMigrators) {
|
|
68
|
-
errors.push(...(
|
|
60
|
+
errors.push(...(builderMigrator.validate() ?? []));
|
|
69
61
|
}
|
|
70
62
|
return errors.length ? errors : null;
|
|
71
63
|
}
|
|
@@ -105,7 +97,9 @@ class AppMigrator extends project_migrator_1.ProjectMigrator {
|
|
|
105
97
|
this.moveFile((0, devkit_1.joinPathFragments)(this.project.oldRoot, 'project.json'), (0, devkit_1.joinPathFragments)(this.project.newRoot, 'project.json'));
|
|
106
98
|
this.projectConfig.root = this.project.newRoot;
|
|
107
99
|
this.projectConfig.sourceRoot = this.project.newSourceRoot;
|
|
108
|
-
(0, devkit_1.updateProjectConfiguration)(this.tree, this.project.name,
|
|
100
|
+
(0, devkit_1.updateProjectConfiguration)(this.tree, this.project.name, {
|
|
101
|
+
...this.projectConfig,
|
|
102
|
+
});
|
|
109
103
|
}
|
|
110
104
|
updateProjectConfigurationTargets() {
|
|
111
105
|
if (!this.projectConfig.targets ||
|
|
@@ -117,7 +111,9 @@ class AppMigrator extends project_migrator_1.ProjectMigrator {
|
|
|
117
111
|
this.updateServerTargetConfiguration();
|
|
118
112
|
this.updatePrerenderTargetConfiguration();
|
|
119
113
|
this.updateServeSsrTargetConfiguration();
|
|
120
|
-
(0, devkit_1.updateProjectConfiguration)(this.tree, this.project.name,
|
|
114
|
+
(0, devkit_1.updateProjectConfiguration)(this.tree, this.project.name, {
|
|
115
|
+
...this.projectConfig,
|
|
116
|
+
});
|
|
121
117
|
}
|
|
122
118
|
updateTsConfigs() {
|
|
123
119
|
const rootTsConfigFile = (0, js_1.getRootTsConfigPathInTree)(this.tree);
|
|
@@ -174,7 +170,6 @@ class AppMigrator extends project_migrator_1.ProjectMigrator {
|
|
|
174
170
|
}));
|
|
175
171
|
}
|
|
176
172
|
updateBuildTargetConfiguration() {
|
|
177
|
-
var _a, _b, _c, _d, _e, _f;
|
|
178
173
|
if (!this.targetNames.build) {
|
|
179
174
|
this.logger.warn('There is no build target in the project configuration. Skipping updating the build target configuration.');
|
|
180
175
|
return;
|
|
@@ -189,7 +184,8 @@ class AppMigrator extends project_migrator_1.ProjectMigrator {
|
|
|
189
184
|
this.logger.warn(`The target "${this.targetNames.build}" is not specifying any options or configurations. Skipping updating the target configuration.`);
|
|
190
185
|
return;
|
|
191
186
|
}
|
|
192
|
-
const buildDevTsConfig =
|
|
187
|
+
const buildDevTsConfig = buildTarget.options?.tsConfig ??
|
|
188
|
+
buildTarget.configurations?.development?.tsConfig;
|
|
193
189
|
if (!buildDevTsConfig) {
|
|
194
190
|
this.logger.warn(`The "${this.targetNames.build}" target does not have the "tsConfig" option configured. Skipping updating the tsConfig file.`);
|
|
195
191
|
}
|
|
@@ -199,8 +195,8 @@ class AppMigrator extends project_migrator_1.ProjectMigrator {
|
|
|
199
195
|
this.logger.warn(`The tsConfig file "${buildDevTsConfig}" specified in the "${this.targetNames.build}" target could not be found. Skipping updating the tsConfig file.`);
|
|
200
196
|
}
|
|
201
197
|
}
|
|
202
|
-
this.convertBuildOptions(
|
|
203
|
-
Object.values(
|
|
198
|
+
this.convertBuildOptions(buildTarget.options ?? {});
|
|
199
|
+
Object.values(buildTarget.configurations ?? {}).forEach((config) => this.convertBuildOptions(config));
|
|
204
200
|
}
|
|
205
201
|
updatePrerenderTargetConfiguration() {
|
|
206
202
|
if (!this.targetNames.prerender ||
|
|
@@ -217,7 +213,6 @@ class AppMigrator extends project_migrator_1.ProjectMigrator {
|
|
|
217
213
|
this.convertPath(prerenderTarget.options.routesFile);
|
|
218
214
|
}
|
|
219
215
|
updateServerTargetConfiguration() {
|
|
220
|
-
var _a, _b, _c, _d, _e, _f;
|
|
221
216
|
if (!this.targetNames.server ||
|
|
222
217
|
this.shouldSkipTargetTypeMigration('server')) {
|
|
223
218
|
return;
|
|
@@ -229,7 +224,8 @@ class AppMigrator extends project_migrator_1.ProjectMigrator {
|
|
|
229
224
|
this.logger.warn(`The target "${this.targetNames.server}" is not specifying any options or configurations. Skipping updating the target configuration.`);
|
|
230
225
|
return;
|
|
231
226
|
}
|
|
232
|
-
const serverDevTsConfig =
|
|
227
|
+
const serverDevTsConfig = serverTarget.options?.tsConfig ??
|
|
228
|
+
serverTarget.configurations?.development?.tsConfig;
|
|
233
229
|
if (!serverDevTsConfig) {
|
|
234
230
|
this.logger.warn(`The "${this.targetNames.server}" target does not have the "tsConfig" option configured. Skipping updating the tsConfig file.`);
|
|
235
231
|
}
|
|
@@ -239,8 +235,8 @@ class AppMigrator extends project_migrator_1.ProjectMigrator {
|
|
|
239
235
|
this.logger.warn(`The tsConfig file "${serverDevTsConfig}" specified in the "${this.targetNames.server}" target could not be found. Skipping updating the tsConfig file.`);
|
|
240
236
|
}
|
|
241
237
|
}
|
|
242
|
-
this.convertServerOptions(
|
|
243
|
-
Object.values(
|
|
238
|
+
this.convertServerOptions(serverTarget.options ?? {});
|
|
239
|
+
Object.values(serverTarget.configurations ?? {}).forEach((config) => this.convertServerOptions(config));
|
|
244
240
|
}
|
|
245
241
|
updateServeSsrTargetConfiguration() {
|
|
246
242
|
if (!this.targetNames.serveSsr ||
|
|
@@ -255,13 +251,12 @@ class AppMigrator extends project_migrator_1.ProjectMigrator {
|
|
|
255
251
|
return;
|
|
256
252
|
}
|
|
257
253
|
['sslKey', 'sslCert', 'proxyConfig'].forEach((option) => {
|
|
258
|
-
var _a;
|
|
259
254
|
if (serveSsrTarget.options) {
|
|
260
255
|
serveSsrTarget.options[option] =
|
|
261
256
|
serveSsrTarget.options[option] &&
|
|
262
257
|
this.convertPath(serveSsrTarget.options[option]);
|
|
263
258
|
}
|
|
264
|
-
for (const configuration of Object.values(
|
|
259
|
+
for (const configuration of Object.values(serveSsrTarget.configurations ?? {})) {
|
|
265
260
|
serveSsrTarget.configurations[configuration][option] =
|
|
266
261
|
serveSsrTarget.configurations[configuration][option] &&
|
|
267
262
|
this.convertPath(serveSsrTarget.configurations[configuration][option]);
|
|
@@ -269,12 +264,13 @@ class AppMigrator extends project_migrator_1.ProjectMigrator {
|
|
|
269
264
|
});
|
|
270
265
|
}
|
|
271
266
|
updateTsConfigFileUsedByBuildTarget(rootTsConfigFile, projectOffsetFromRoot) {
|
|
272
|
-
var _a, _b, _c, _d;
|
|
273
267
|
if (!this.targetNames.build ||
|
|
274
268
|
this.shouldSkipTargetTypeMigration('build')) {
|
|
275
269
|
return;
|
|
276
270
|
}
|
|
277
|
-
const tsConfigPath =
|
|
271
|
+
const tsConfigPath = this.projectConfig.targets[this.targetNames.build].options?.tsConfig ??
|
|
272
|
+
this.projectConfig.targets[this.targetNames.build].configurations
|
|
273
|
+
?.development?.tsConfig;
|
|
278
274
|
if (!tsConfigPath || !this.tree.exists(tsConfigPath)) {
|
|
279
275
|
// we already logged a warning for these cases, so just return
|
|
280
276
|
return;
|
|
@@ -282,19 +278,19 @@ class AppMigrator extends project_migrator_1.ProjectMigrator {
|
|
|
282
278
|
this.updateTsConfigFile(tsConfigPath, rootTsConfigFile, projectOffsetFromRoot);
|
|
283
279
|
}
|
|
284
280
|
updateTsConfigFileUsedByServerTarget(projectOffsetFromRoot) {
|
|
285
|
-
var _a, _b, _c, _d;
|
|
286
281
|
if (!this.targetNames.server ||
|
|
287
282
|
this.shouldSkipTargetTypeMigration('server')) {
|
|
288
283
|
return;
|
|
289
284
|
}
|
|
290
|
-
const tsConfigPath =
|
|
285
|
+
const tsConfigPath = this.projectConfig.targets[this.targetNames.server].options?.tsConfig ??
|
|
286
|
+
this.projectConfig.targets[this.targetNames.server].configurations
|
|
287
|
+
?.development?.tsConfig;
|
|
291
288
|
if (!tsConfigPath || !this.tree.exists(tsConfigPath)) {
|
|
292
289
|
// we already logged a warning for these cases, so just return
|
|
293
290
|
return;
|
|
294
291
|
}
|
|
295
292
|
(0, devkit_1.updateJson)(this.tree, tsConfigPath, (json) => {
|
|
296
|
-
|
|
297
|
-
json.compilerOptions = (_a = json.compilerOptions) !== null && _a !== void 0 ? _a : {};
|
|
293
|
+
json.compilerOptions = json.compilerOptions ?? {};
|
|
298
294
|
json.compilerOptions.outDir = `${projectOffsetFromRoot}dist/out-tsc`;
|
|
299
295
|
return json;
|
|
300
296
|
});
|