@schematics/angular 13.0.0-next.9 → 13.0.0-rc.3

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.
Files changed (53) hide show
  1. package/library/files/tsconfig.lib.json.template +1 -6
  2. package/migrations/migration-collection.json +0 -120
  3. package/package.json +4 -4
  4. package/universal/files/src/__main@stripTsExtension__.ts.template +1 -1
  5. package/universal/index.js +10 -3
  6. package/utility/latest-versions/package.json +2 -2
  7. package/workspace/files/tsconfig.json.template +1 -1
  8. package/migrations/update-10/add-deprecation-rule-tslint.d.ts +0 -9
  9. package/migrations/update-10/add-deprecation-rule-tslint.js +0 -50
  10. package/migrations/update-10/remove-es5-browser-support.d.ts +0 -9
  11. package/migrations/update-10/remove-es5-browser-support.js +0 -114
  12. package/migrations/update-10/remove-solution-style-tsconfig.d.ts +0 -9
  13. package/migrations/update-10/remove-solution-style-tsconfig.js +0 -71
  14. package/migrations/update-10/rename-browserslist-config.d.ts +0 -9
  15. package/migrations/update-10/rename-browserslist-config.js +0 -32
  16. package/migrations/update-10/schematic-options.d.ts +0 -9
  17. package/migrations/update-10/schematic-options.js +0 -49
  18. package/migrations/update-10/update-angular-config.d.ts +0 -9
  19. package/migrations/update-10/update-angular-config.js +0 -106
  20. package/migrations/update-10/update-dependencies.d.ts +0 -9
  21. package/migrations/update-10/update-dependencies.js +0 -60
  22. package/migrations/update-10/update-libraries-tslib.d.ts +0 -9
  23. package/migrations/update-10/update-libraries-tslib.js +0 -37
  24. package/migrations/update-10/update-module-and-target-compiler-options.d.ts +0 -9
  25. package/migrations/update-10/update-module-and-target-compiler-options.js +0 -119
  26. package/migrations/update-10/update-tslint.d.ts +0 -10
  27. package/migrations/update-10/update-tslint.js +0 -122
  28. package/migrations/update-11/add-declaration-map-compiler-option.d.ts +0 -9
  29. package/migrations/update-11/add-declaration-map-compiler-option.js +0 -43
  30. package/migrations/update-11/replace-ng-packagr-builder.d.ts +0 -9
  31. package/migrations/update-11/replace-ng-packagr-builder.js +0 -37
  32. package/migrations/update-11/update-angular-config.d.ts +0 -9
  33. package/migrations/update-11/update-angular-config.js +0 -77
  34. package/migrations/update-11/update-dependencies.d.ts +0 -9
  35. package/migrations/update-11/update-dependencies.js +0 -44
  36. package/migrations/update-12/production-default-config.d.ts +0 -9
  37. package/migrations/update-12/production-default-config.js +0 -113
  38. package/migrations/update-12/remove-emit-decorator-metadata.d.ts +0 -9
  39. package/migrations/update-12/remove-emit-decorator-metadata.js +0 -49
  40. package/migrations/update-12/replace-prod-flag.d.ts +0 -9
  41. package/migrations/update-12/replace-prod-flag.js +0 -28
  42. package/migrations/update-12/schematic-options.d.ts +0 -9
  43. package/migrations/update-12/schematic-options.js +0 -38
  44. package/migrations/update-12/update-angular-config.d.ts +0 -9
  45. package/migrations/update-12/update-angular-config.js +0 -81
  46. package/migrations/update-12/update-i18n.d.ts +0 -9
  47. package/migrations/update-12/update-i18n.js +0 -170
  48. package/migrations/update-12/update-lazy-module-paths.d.ts +0 -9
  49. package/migrations/update-12/update-lazy-module-paths.js +0 -79
  50. package/migrations/update-12/update-web-workers.d.ts +0 -9
  51. package/migrations/update-12/update-web-workers.js +0 -102
  52. package/migrations/update-12/update-zonejs.d.ts +0 -9
  53. package/migrations/update-12/update-zonejs.js +0 -75
@@ -3,15 +3,10 @@
3
3
  "extends": "<%= relativePathToWorkspaceRoot %>/tsconfig.json",
4
4
  "compilerOptions": {
5
5
  "outDir": "<%= relativePathToWorkspaceRoot %>/out-tsc/lib",
6
- "target": "es2015",
7
6
  "declaration": true,
8
7
  "declarationMap": true,
9
8
  "inlineSources": true,
10
- "types": [],
11
- "lib": [
12
- "dom",
13
- "es2018"
14
- ]
9
+ "types": []
15
10
  },
16
11
  "exclude": [
17
12
  "src/test.ts",
@@ -1,125 +1,5 @@
1
1
  {
2
2
  "schematics": {
3
- "lazy-loading-syntax": {
4
- "version": "9.0.0-next.6",
5
- "factory": "./update-12/update-lazy-module-paths",
6
- "description": "Lazy loading syntax migration. Update lazy loading syntax to use dynamic imports."
7
- },
8
- "tslint-version-6": {
9
- "version": "10.0.0-beta.0",
10
- "factory": "./update-10/update-tslint",
11
- "description": "Update tslint to version 6 and adjust rules to maintain existing behavior."
12
- },
13
- "rename-browserslist-config": {
14
- "version": "10.0.0-beta.0",
15
- "factory": "./update-10/rename-browserslist-config",
16
- "description": "Update Browserslist configuration file name to '.browserslistrc' from deprecated 'browserslist'."
17
- },
18
- "remove-es5-browser-support-option": {
19
- "version": "10.0.0-beta.2",
20
- "factory": "./update-10/remove-es5-browser-support",
21
- "description": "Remove deprecated 'es5BrowserSupport' browser builder option. The inclusion for ES5 polyfills will be determined from the browsers listed in the browserslist configuration."
22
- },
23
- "schematic-options-10": {
24
- "version": "10.0.0-beta.2",
25
- "factory": "./update-10/schematic-options",
26
- "description": "Replace deprecated and removed 'styleext' and 'spec' Angular schematic options with 'style' and 'skipTests', respectively."
27
- },
28
- "update-angular-config": {
29
- "version": "10.0.0-beta.6",
30
- "factory": "./update-10/update-angular-config",
31
- "description": "Remove deprecated options from 'angular.json' that are no longer present in v10."
32
- },
33
- "tslint-add-deprecation-rule": {
34
- "version": "10.0.0-beta.7",
35
- "factory": "./update-10/add-deprecation-rule-tslint",
36
- "description": "Add the tslint deprecation rule to tslint JSON configuration files."
37
- },
38
- "update-libraries-tslib": {
39
- "version": "10.0.0-beta.7",
40
- "factory": "./update-10/update-libraries-tslib",
41
- "description": "Update library projects to use tslib version 2 as a direct dependency. Read more about this here: https://v10.angular.io/guide/migration-update-libraries-tslib"
42
- },
43
- "update-workspace-dependencies": {
44
- "version": "10.0.0-rc.2",
45
- "factory": "./update-10/update-dependencies",
46
- "description": "Update workspace dependencies to match a new v10 project."
47
- },
48
- "update-module-and-target-compiler-options": {
49
- "version": "10.0.1",
50
- "factory": "./update-10/update-module-and-target-compiler-options",
51
- "description": "Update 'module' and 'target' TypeScript compiler options. Read more about this here: https://v10.angular.io/guide/migration-update-module-and-target-compiler-options"
52
- },
53
- "remove-solution-style-tsconfig": {
54
- "version": "10.1.0-next.5",
55
- "factory": "./update-10/remove-solution-style-tsconfig",
56
- "description": "Removing \"Solution Style\" TypeScript configuration file support."
57
- },
58
- "replace-ng-packagr-builder": {
59
- "version": "11.0.0-next.0",
60
- "factory": "./update-11/replace-ng-packagr-builder",
61
- "description": "Replace deprecated library builder '@angular-devkit/build-ng-packagr'."
62
- },
63
- "add-declaration-map-compiler-option": {
64
- "version": "11.0.0-next.2",
65
- "factory": "./update-11/add-declaration-map-compiler-option",
66
- "description": "Add 'declarationMap' compiler options for non production library builds."
67
- },
68
- "update-angular-config-v11": {
69
- "version": "11.0.0-next.8",
70
- "factory": "./update-11/update-angular-config",
71
- "description": "Remove deprecated options from 'angular.json' that are no longer present in v11."
72
- },
73
- "update-workspace-dependencies-v11": {
74
- "version": "11.0.0",
75
- "factory": "./update-11/update-dependencies",
76
- "description": "Update workspace dependencies to match a new v11 project."
77
- },
78
- "update-angular-config-v12": {
79
- "version": "12.0.0-next.0",
80
- "factory": "./update-12/update-angular-config",
81
- "description": "Remove deprecated options from 'angular.json' that are no longer present in v12."
82
- },
83
- "update-zonejs": {
84
- "version": "12.0.0-next.1",
85
- "factory": "./update-12/update-zonejs",
86
- "description": "Update 'zone.js' to version 0.11.x. Read more about this here: https://github.com/angular/angular/blob/master/packages/zone.js/CHANGELOG.md#breaking-changes-since-zonejs-v0111"
87
- },
88
- "remove-emit-decorator-metadata": {
89
- "version": "12.0.0-next.2",
90
- "factory": "./update-12/remove-emit-decorator-metadata",
91
- "description": "Remove 'emitDecoratorMetadata' TypeScript compiler option. Decorator metadata is no longer needed by Angular. Read more about this here: https://www.typescriptlang.org/docs/handbook/decorators.html#metadata"
92
- },
93
- "lazy-loading-string-syntax": {
94
- "version": "12.0.0-next.4",
95
- "factory": "./update-12/update-lazy-module-paths",
96
- "description": "Lazy loading syntax migration. Update lazy loading string syntax to use dynamic imports."
97
- },
98
- "remove-deprecated-i18n-options": {
99
- "version": "12.0.0-next.7",
100
- "factory": "./update-12/update-i18n",
101
- "description": "Remove deprecated ViewEngine-based i18n build and extract options. Options present in the configuration will be converted to use non-deprecated options."
102
- },
103
- "update-web-workers-webpack-5": {
104
- "version": "12.0.0-next.7",
105
- "factory": "./update-12/update-web-workers",
106
- "description": "Updates Web Worker consumer usage to use the new syntax supported directly by Webpack 5."
107
- },
108
- "schematic-options-12": {
109
- "version": "12.0.1",
110
- "factory": "./update-12/schematic-options",
111
- "description": "Remove invalid 'skipTests' option in '@schematics/angular:module' Angular schematic options."
112
- },
113
- "replace-deprecated-prod-flag": {
114
- "version": "12.1.0",
115
- "factory": "./update-12/replace-prod-flag",
116
- "description": "Replace the deprecated '--prod' in package.json scripts."
117
- },
118
- "production-by-default": {
119
- "version": "9999.0.0",
120
- "factory": "./update-12/production-default-config",
121
- "description": "Optional migration to update Angular CLI workspace configurations to 'production' mode by default."
122
- },
123
3
  "schematic-options-13": {
124
4
  "version": "13.0.0",
125
5
  "factory": "./update-13/schematic-options",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@schematics/angular",
3
- "version": "13.0.0-next.9",
3
+ "version": "13.0.0-rc.3",
4
4
  "description": "Schematics specific to Angular",
5
5
  "homepage": "https://github.com/angular/angular-cli",
6
6
  "keywords": [
@@ -15,8 +15,8 @@
15
15
  ],
16
16
  "schematics": "./collection.json",
17
17
  "dependencies": {
18
- "@angular-devkit/core": "13.0.0-next.9",
19
- "@angular-devkit/schematics": "13.0.0-next.9",
18
+ "@angular-devkit/core": "13.0.0-rc.3",
19
+ "@angular-devkit/schematics": "13.0.0-rc.3",
20
20
  "jsonc-parser": "3.0.0"
21
21
  },
22
22
  "repository": {
@@ -25,7 +25,7 @@
25
25
  },
26
26
  "engines": {
27
27
  "node": "^12.20.0 || ^14.15.0 || >=16.10.0",
28
- "npm": "^6.11.0 || ^7.5.6",
28
+ "npm": "^6.11.0 || ^7.5.6 || >=8.0.0",
29
29
  "yarn": ">= 1.13.0"
30
30
  },
31
31
  "author": "Angular Authors",
@@ -21,4 +21,4 @@ if (environment.production) {
21
21
  }
22
22
 
23
23
  export { <%= rootModuleClassName %> } from './app/<%= stripTsExtension(rootModuleFileName) %>';
24
- export { renderModule, renderModuleFactory } from '@angular/platform-server';
24
+ export { renderModule } from '@angular/platform-server';
@@ -130,9 +130,16 @@ function wrapBootstrapCall(mainFile) {
130
130
  }
131
131
  // indent contents
132
132
  const triviaWidth = bootstrapCall.getLeadingTriviaWidth();
133
- const beforeText = `document.addEventListener('DOMContentLoaded', () => {\n` +
134
- ' '.repeat(triviaWidth > 2 ? triviaWidth + 1 : triviaWidth);
135
- const afterText = `\n${triviaWidth > 2 ? ' '.repeat(triviaWidth - 1) : ''}});`;
133
+ const beforeText = `function bootstrap() {\n` + ' '.repeat(triviaWidth > 2 ? triviaWidth + 1 : triviaWidth);
134
+ const afterText = `\n${triviaWidth > 2 ? ' '.repeat(triviaWidth - 1) : ''}};\n` +
135
+ `
136
+
137
+ if (document.readyState === 'complete') {
138
+ bootstrap();
139
+ } else {
140
+ document.addEventListener('DOMContentLoaded', bootstrap);
141
+ }
142
+ `;
136
143
  // in some cases we need to cater for a trailing semicolon such as;
137
144
  // bootstrap().catch(err => console.log(err));
138
145
  const lastToken = bootstrapCall.parent.getLastToken();
@@ -3,9 +3,9 @@
3
3
  "comment": "This file is needed so that depedencies are synced by Renovate.",
4
4
  "private": true,
5
5
  "dependencies": {
6
- "@types/jasmine": "~3.9.0",
6
+ "@types/jasmine": "~3.10.0",
7
7
  "@types/node": "^12.11.1",
8
- "jasmine-core": "~3.9.0",
8
+ "jasmine-core": "~3.10.0",
9
9
  "karma-chrome-launcher": "~3.1.0",
10
10
  "karma-coverage": "~2.0.3",
11
11
  "karma-jasmine-html-reporter": "~1.7.0",
@@ -19,7 +19,7 @@
19
19
  "target": "es2017",
20
20
  "module": "es2020",
21
21
  "lib": [
22
- "es2018",
22
+ "es2020",
23
23
  "dom"
24
24
  ]
25
25
  },
@@ -1,9 +0,0 @@
1
- /**
2
- * @license
3
- * Copyright Google LLC All Rights Reserved.
4
- *
5
- * Use of this source code is governed by an MIT-style license that can be
6
- * found in the LICENSE file at https://angular.io/license
7
- */
8
- import { Rule } from '@angular-devkit/schematics';
9
- export default function (): Rule;
@@ -1,50 +0,0 @@
1
- "use strict";
2
- /**
3
- * @license
4
- * Copyright Google LLC All Rights Reserved.
5
- *
6
- * Use of this source code is governed by an MIT-style license that can be
7
- * found in the LICENSE file at https://angular.io/license
8
- */
9
- Object.defineProperty(exports, "__esModule", { value: true });
10
- const dependencies_1 = require("../../utility/dependencies");
11
- const json_file_1 = require("../../utility/json-file");
12
- const TSLINT_CONFIG_PATH = '/tslint.json';
13
- const RULES_TO_ADD = {
14
- deprecation: {
15
- severity: 'warning',
16
- },
17
- };
18
- function default_1() {
19
- return (tree, context) => {
20
- const logger = context.logger;
21
- // Update tslint dependency
22
- const current = (0, dependencies_1.getPackageJsonDependency)(tree, 'tslint');
23
- if (!current) {
24
- logger.info('Skipping: "tslint" in not a dependency of this workspace.');
25
- return;
26
- }
27
- // Update tslint config.
28
- let json;
29
- try {
30
- json = new json_file_1.JSONFile(tree, TSLINT_CONFIG_PATH);
31
- }
32
- catch {
33
- const config = ['tslint.js', 'tslint.yaml'].find((c) => tree.exists(c));
34
- if (config) {
35
- logger.warn(`Expected a JSON configuration file but found "${config}".`);
36
- }
37
- else {
38
- logger.warn('Cannot find "tslint.json" configuration file.');
39
- }
40
- return;
41
- }
42
- for (const [name, value] of Object.entries(RULES_TO_ADD)) {
43
- const ruleName = ['rules', name];
44
- if (json.get(ruleName) === undefined) {
45
- json.modify(ruleName, value);
46
- }
47
- }
48
- };
49
- }
50
- exports.default = default_1;
@@ -1,9 +0,0 @@
1
- /**
2
- * @license
3
- * Copyright Google LLC All Rights Reserved.
4
- *
5
- * Use of this source code is governed by an MIT-style license that can be
6
- * found in the LICENSE file at https://angular.io/license
7
- */
8
- import { Rule } from '@angular-devkit/schematics';
9
- export default function (): Rule;
@@ -1,114 +0,0 @@
1
- "use strict";
2
- /**
3
- * @license
4
- * Copyright Google LLC All Rights Reserved.
5
- *
6
- * Use of this source code is governed by an MIT-style license that can be
7
- * found in the LICENSE file at https://angular.io/license
8
- */
9
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
12
- }) : (function(o, m, k, k2) {
13
- if (k2 === undefined) k2 = k;
14
- o[k2] = m[k];
15
- }));
16
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
17
- Object.defineProperty(o, "default", { enumerable: true, value: v });
18
- }) : function(o, v) {
19
- o["default"] = v;
20
- });
21
- var __importStar = (this && this.__importStar) || function (mod) {
22
- if (mod && mod.__esModule) return mod;
23
- var result = {};
24
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
25
- __setModuleDefault(result, mod);
26
- return result;
27
- };
28
- Object.defineProperty(exports, "__esModule", { value: true });
29
- const core_1 = require("@angular-devkit/core");
30
- const workspace_1 = require("../../utility/workspace");
31
- const workspace_models_1 = require("../../utility/workspace-models");
32
- function default_1() {
33
- return async (host, context) => {
34
- const workspace = await (0, workspace_1.getWorkspace)(host);
35
- for (const [projectName, project] of workspace.projects) {
36
- if (project.extensions.projectType !== workspace_models_1.ProjectType.Application) {
37
- // Only interested in application projects
38
- continue;
39
- }
40
- for (const [, target] of project.targets) {
41
- // Only interested in Angular Devkit Browser builder
42
- if ((target === null || target === void 0 ? void 0 : target.builder) !== workspace_models_1.Builders.Browser) {
43
- continue;
44
- }
45
- const isES5Needed = await isES5SupportNeeded((0, core_1.resolve)((0, core_1.normalize)(host.root.path), (0, core_1.normalize)(project.root)));
46
- // Check options
47
- if (target.options) {
48
- target.options = removeE5BrowserSupportOption(projectName, target.options, isES5Needed, context.logger);
49
- }
50
- // Go through each configuration entry
51
- if (!target.configurations) {
52
- continue;
53
- }
54
- for (const [configurationName, options] of Object.entries(target.configurations)) {
55
- target.configurations[configurationName] = removeE5BrowserSupportOption(projectName, options, isES5Needed, context.logger, configurationName);
56
- }
57
- }
58
- }
59
- return (0, workspace_1.updateWorkspace)(workspace);
60
- };
61
- }
62
- exports.default = default_1;
63
- function removeE5BrowserSupportOption(projectName, options, isES5Needed, logger, configurationName = '') {
64
- if (typeof (options === null || options === void 0 ? void 0 : options.es5BrowserSupport) !== 'boolean') {
65
- return options;
66
- }
67
- const configurationPath = configurationName ? `configurations.${configurationName}.` : '';
68
- if (options.es5BrowserSupport && isES5Needed === false) {
69
- logger.warn(`Project '${projectName}' doesn't require ES5 support, but '${configurationPath}es5BrowserSupport' was set to 'true'.\n` +
70
- `ES5 polyfills will no longer be added when building this project${configurationName ? ` with '${configurationName}' configuration.` : '.'}\n` +
71
- `If ES5 polyfills are needed, add the supported ES5 browsers in the browserslist configuration.`);
72
- }
73
- else if (!options.es5BrowserSupport && isES5Needed === true) {
74
- logger.warn(`Project '${projectName}' requires ES5 support, but '${configurationPath}es5BrowserSupport' was set to 'false'.\n` +
75
- `ES5 polyfills will be added when building this project${configurationName ? ` with '${configurationName}' configuration.` : '.'}\n` +
76
- `If ES5 polyfills are not needed, remove the unsupported ES5 browsers from the browserslist configuration.`);
77
- }
78
- return {
79
- ...options,
80
- es5BrowserSupport: undefined,
81
- };
82
- }
83
- /**
84
- * True, when one or more browsers requires ES5 support
85
- */
86
- async function isES5SupportNeeded(projectRoot) {
87
- // y: feature is fully available
88
- // n: feature is unavailable
89
- // a: feature is partially supported
90
- // x: feature is prefixed
91
- const criteria = ['y', 'a'];
92
- try {
93
- // eslint-disable-next-line import/no-extraneous-dependencies
94
- const browserslist = (await Promise.resolve().then(() => __importStar(require('browserslist')))).default;
95
- const supportedBrowsers = browserslist(undefined, {
96
- path: (0, core_1.getSystemPath)(projectRoot),
97
- });
98
- // eslint-disable-next-line import/no-extraneous-dependencies
99
- const { feature, features } = await Promise.resolve().then(() => __importStar(require('caniuse-lite')));
100
- const data = feature(features['es6-module']);
101
- return supportedBrowsers.some((browser) => {
102
- const [agentId, version] = browser.split(' ');
103
- const browserData = data.stats[agentId];
104
- const featureStatus = (browserData && browserData[version]);
105
- // We are only interested in the first character
106
- // Ex: when 'a #4 #5', we only need to check for 'a'
107
- // as for such cases we should polyfill these features as needed
108
- return !featureStatus || !criteria.includes(featureStatus.charAt(0));
109
- });
110
- }
111
- catch {
112
- return undefined;
113
- }
114
- }
@@ -1,9 +0,0 @@
1
- /**
2
- * @license
3
- * Copyright Google LLC All Rights Reserved.
4
- *
5
- * Use of this source code is governed by an MIT-style license that can be
6
- * found in the LICENSE file at https://angular.io/license
7
- */
8
- import { Rule } from '@angular-devkit/schematics';
9
- export default function (): Rule;
@@ -1,71 +0,0 @@
1
- "use strict";
2
- /**
3
- * @license
4
- * Copyright Google LLC All Rights Reserved.
5
- *
6
- * Use of this source code is governed by an MIT-style license that can be
7
- * found in the LICENSE file at https://angular.io/license
8
- */
9
- Object.defineProperty(exports, "__esModule", { value: true });
10
- const core_1 = require("@angular-devkit/core");
11
- const json_file_1 = require("../../utility/json-file");
12
- function* visitExtendedJsonFiles(directory) {
13
- for (const path of directory.subfiles) {
14
- if (!path.endsWith('.json')) {
15
- continue;
16
- }
17
- const entry = directory.file(path);
18
- const content = entry === null || entry === void 0 ? void 0 : entry.content.toString();
19
- if (content === null || content === void 0 ? void 0 : content.includes('tsconfig.base.json')) {
20
- yield (0, core_1.join)(directory.path, path);
21
- }
22
- }
23
- for (const path of directory.subdirs) {
24
- if (path === 'node_modules' || path.startsWith('.')) {
25
- continue;
26
- }
27
- yield* visitExtendedJsonFiles(directory.dir(path));
28
- }
29
- }
30
- function default_1() {
31
- return (host, context) => {
32
- const logger = context.logger;
33
- const tsConfigExists = host.exists('tsconfig.json');
34
- if (tsConfigExists) {
35
- const files = new json_file_1.JSONFile(host, 'tsconfig.json').get(['files']);
36
- if (!(Array.isArray(files) && files.length === 0)) {
37
- logger.info('Migration has already been executed.');
38
- return;
39
- }
40
- }
41
- if (host.exists('tsconfig.base.json')) {
42
- if (tsConfigExists) {
43
- host.overwrite('tsconfig.json', host.read('tsconfig.base.json') || '');
44
- host.delete('tsconfig.base.json');
45
- }
46
- else {
47
- host.rename('tsconfig.base.json', 'tsconfig.json');
48
- }
49
- }
50
- // Iterate over all tsconfig files and change the extends from 'tsconfig.base.json' to 'tsconfig.json'.
51
- const extendsJsonPath = ['extends'];
52
- for (const path of visitExtendedJsonFiles(host.root)) {
53
- try {
54
- const tsConfigDir = (0, core_1.dirname)((0, core_1.normalize)(path));
55
- const tsConfigJson = new json_file_1.JSONFile(host, path);
56
- const extendsValue = tsConfigJson.get(extendsJsonPath);
57
- if (typeof extendsValue === 'string' &&
58
- '/tsconfig.base.json' === (0, core_1.resolve)(tsConfigDir, (0, core_1.normalize)(extendsValue))) {
59
- // tsconfig extends the workspace tsconfig path.
60
- tsConfigJson.modify(extendsJsonPath, extendsValue.replace('tsconfig.base.json', 'tsconfig.json'));
61
- }
62
- }
63
- catch (error) {
64
- logger.warn(`${error.message || error}\n` +
65
- 'If this is a TypeScript configuration file you will need to update the "extends" value manually.');
66
- continue;
67
- }
68
- }
69
- };
70
- }
71
- exports.default = default_1;
@@ -1,9 +0,0 @@
1
- /**
2
- * @license
3
- * Copyright Google LLC All Rights Reserved.
4
- *
5
- * Use of this source code is governed by an MIT-style license that can be
6
- * found in the LICENSE file at https://angular.io/license
7
- */
8
- import { Rule } from '@angular-devkit/schematics';
9
- export default function (): Rule;
@@ -1,32 +0,0 @@
1
- "use strict";
2
- /**
3
- * @license
4
- * Copyright Google LLC All Rights Reserved.
5
- *
6
- * Use of this source code is governed by an MIT-style license that can be
7
- * found in the LICENSE file at https://angular.io/license
8
- */
9
- Object.defineProperty(exports, "__esModule", { value: true });
10
- const core_1 = require("@angular-devkit/core");
11
- function* visit(directory) {
12
- for (const path of directory.subfiles) {
13
- if (path !== 'browserslist') {
14
- continue;
15
- }
16
- yield (0, core_1.join)(directory.path, path);
17
- }
18
- for (const path of directory.subdirs) {
19
- if (path === 'node_modules' || path.startsWith('.')) {
20
- continue;
21
- }
22
- yield* visit(directory.dir(path));
23
- }
24
- }
25
- function default_1() {
26
- return (tree) => {
27
- for (const path of visit(tree.root)) {
28
- tree.rename(path, path.replace(/browserslist$/, '.browserslistrc'));
29
- }
30
- };
31
- }
32
- exports.default = default_1;
@@ -1,9 +0,0 @@
1
- /**
2
- * @license
3
- * Copyright Google LLC All Rights Reserved.
4
- *
5
- * Use of this source code is governed by an MIT-style license that can be
6
- * found in the LICENSE file at https://angular.io/license
7
- */
8
- import { Rule } from '@angular-devkit/schematics';
9
- export default function (): Rule;
@@ -1,49 +0,0 @@
1
- "use strict";
2
- /**
3
- * @license
4
- * Copyright Google LLC All Rights Reserved.
5
- *
6
- * Use of this source code is governed by an MIT-style license that can be
7
- * found in the LICENSE file at https://angular.io/license
8
- */
9
- Object.defineProperty(exports, "__esModule", { value: true });
10
- const core_1 = require("@angular-devkit/core");
11
- const workspace_1 = require("../../utility/workspace");
12
- function default_1() {
13
- return (0, workspace_1.updateWorkspace)((workspace) => {
14
- // Update root level schematics options if present
15
- const rootSchematics = workspace.extensions.schematics;
16
- if (rootSchematics && core_1.json.isJsonObject(rootSchematics)) {
17
- updateSchematicsField(rootSchematics);
18
- }
19
- // Update project level schematics options if present
20
- for (const [, project] of workspace.projects) {
21
- const projectSchematics = project.extensions.schematics;
22
- if (projectSchematics && core_1.json.isJsonObject(projectSchematics)) {
23
- updateSchematicsField(projectSchematics);
24
- }
25
- }
26
- });
27
- }
28
- exports.default = default_1;
29
- function updateSchematicsField(schematics) {
30
- for (const [schematicName, schematicOptions] of Object.entries(schematics)) {
31
- if (!core_1.json.isJsonObject(schematicOptions)) {
32
- continue;
33
- }
34
- if (!schematicName.startsWith('@schematics/angular:')) {
35
- continue;
36
- }
37
- // Replace `styleext` with `style`
38
- if (schematicOptions.styleext !== undefined) {
39
- schematicOptions.style = schematicOptions.styleext;
40
- delete schematicOptions.styleext;
41
- }
42
- // Replace `spec` with `skipTests`
43
- if (schematicOptions.spec !== undefined) {
44
- // skipTests value is inverted
45
- schematicOptions.skipTests = !schematicOptions.spec;
46
- delete schematicOptions.spec;
47
- }
48
- }
49
- }
@@ -1,9 +0,0 @@
1
- /**
2
- * @license
3
- * Copyright Google LLC All Rights Reserved.
4
- *
5
- * Use of this source code is governed by an MIT-style license that can be
6
- * found in the LICENSE file at https://angular.io/license
7
- */
8
- import { Rule } from '@angular-devkit/schematics';
9
- export default function (): Rule;