@schematics/angular 13.0.0-rc.1 → 13.0.1
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/migrations/migration-collection.json +0 -120
- package/package.json +3 -3
- package/utility/latest-versions/package.json +1 -1
- package/utility/latest-versions.js +1 -1
- package/migrations/update-10/add-deprecation-rule-tslint.d.ts +0 -9
- package/migrations/update-10/add-deprecation-rule-tslint.js +0 -50
- package/migrations/update-10/remove-es5-browser-support.d.ts +0 -9
- package/migrations/update-10/remove-es5-browser-support.js +0 -114
- package/migrations/update-10/remove-solution-style-tsconfig.d.ts +0 -9
- package/migrations/update-10/remove-solution-style-tsconfig.js +0 -71
- package/migrations/update-10/rename-browserslist-config.d.ts +0 -9
- package/migrations/update-10/rename-browserslist-config.js +0 -32
- package/migrations/update-10/schematic-options.d.ts +0 -9
- package/migrations/update-10/schematic-options.js +0 -49
- package/migrations/update-10/update-angular-config.d.ts +0 -9
- package/migrations/update-10/update-angular-config.js +0 -106
- package/migrations/update-10/update-dependencies.d.ts +0 -9
- package/migrations/update-10/update-dependencies.js +0 -60
- package/migrations/update-10/update-libraries-tslib.d.ts +0 -9
- package/migrations/update-10/update-libraries-tslib.js +0 -37
- package/migrations/update-10/update-module-and-target-compiler-options.d.ts +0 -9
- package/migrations/update-10/update-module-and-target-compiler-options.js +0 -119
- package/migrations/update-10/update-tslint.d.ts +0 -10
- package/migrations/update-10/update-tslint.js +0 -122
- package/migrations/update-11/add-declaration-map-compiler-option.d.ts +0 -9
- package/migrations/update-11/add-declaration-map-compiler-option.js +0 -43
- package/migrations/update-11/replace-ng-packagr-builder.d.ts +0 -9
- package/migrations/update-11/replace-ng-packagr-builder.js +0 -37
- package/migrations/update-11/update-angular-config.d.ts +0 -9
- package/migrations/update-11/update-angular-config.js +0 -77
- package/migrations/update-11/update-dependencies.d.ts +0 -9
- package/migrations/update-11/update-dependencies.js +0 -44
- package/migrations/update-12/production-default-config.d.ts +0 -9
- package/migrations/update-12/production-default-config.js +0 -113
- package/migrations/update-12/remove-emit-decorator-metadata.d.ts +0 -9
- package/migrations/update-12/remove-emit-decorator-metadata.js +0 -49
- package/migrations/update-12/replace-prod-flag.d.ts +0 -9
- package/migrations/update-12/replace-prod-flag.js +0 -28
- package/migrations/update-12/schematic-options.d.ts +0 -9
- package/migrations/update-12/schematic-options.js +0 -38
- package/migrations/update-12/update-angular-config.d.ts +0 -9
- package/migrations/update-12/update-angular-config.js +0 -81
- package/migrations/update-12/update-i18n.d.ts +0 -9
- package/migrations/update-12/update-i18n.js +0 -170
- package/migrations/update-12/update-lazy-module-paths.d.ts +0 -9
- package/migrations/update-12/update-lazy-module-paths.js +0 -79
- package/migrations/update-12/update-web-workers.d.ts +0 -9
- package/migrations/update-12/update-web-workers.js +0 -102
- package/migrations/update-12/update-zonejs.d.ts +0 -9
- package/migrations/update-12/update-zonejs.js +0 -75
|
@@ -1,60 +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 tasks_1 = require("@angular-devkit/schematics/tasks");
|
|
11
|
-
const dependencies_1 = require("../../utility/dependencies");
|
|
12
|
-
const latest_versions_1 = require("../../utility/latest-versions");
|
|
13
|
-
function default_1() {
|
|
14
|
-
return (host, context) => {
|
|
15
|
-
const dependenciesToUpdate = {
|
|
16
|
-
'jasmine-core': '~3.5.0',
|
|
17
|
-
'jasmine-spec-reporter': '~5.0.0',
|
|
18
|
-
'karma': '~5.0.0',
|
|
19
|
-
'karma-chrome-launcher': '~3.1.0',
|
|
20
|
-
'karma-coverage-istanbul-reporter': '~3.0.2',
|
|
21
|
-
'karma-jasmine': '~4.0.0',
|
|
22
|
-
'karma-jasmine-html-reporter': '^1.5.0',
|
|
23
|
-
'protractor': '~7.0.0',
|
|
24
|
-
'ng-packagr': latest_versions_1.latestVersions['ng-packagr'],
|
|
25
|
-
'tslib': '^2.0.0',
|
|
26
|
-
};
|
|
27
|
-
let hasChanges = false;
|
|
28
|
-
for (const [name, version] of Object.entries(dependenciesToUpdate)) {
|
|
29
|
-
const current = (0, dependencies_1.getPackageJsonDependency)(host, name);
|
|
30
|
-
if (!current || current.version === version) {
|
|
31
|
-
continue;
|
|
32
|
-
}
|
|
33
|
-
(0, dependencies_1.addPackageJsonDependency)(host, {
|
|
34
|
-
type: current.type,
|
|
35
|
-
name,
|
|
36
|
-
version,
|
|
37
|
-
overwrite: true,
|
|
38
|
-
});
|
|
39
|
-
hasChanges = true;
|
|
40
|
-
}
|
|
41
|
-
if (hasChanges) {
|
|
42
|
-
context.addTask(new tasks_1.NodePackageInstallTask());
|
|
43
|
-
}
|
|
44
|
-
// Check for @angular-devkit/schematics and @angular-devkit/core
|
|
45
|
-
for (const name of ['@angular-devkit/schematics', '@angular-devkit/core']) {
|
|
46
|
-
if ((0, dependencies_1.getPackageJsonDependency)(host, name)) {
|
|
47
|
-
context.logger.info(`Package "${name}" found in the workspace package.json. ` +
|
|
48
|
-
'This package typically does not need to be installed manually. ' +
|
|
49
|
-
'If it is not being used by project code, it can be removed from the package.json.');
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
if ((0, dependencies_1.getPackageJsonDependency)(host, 'rxjs-compat')) {
|
|
53
|
-
context.logger.info(`Package "rxjs-compat" found in the workspace package.json. ` +
|
|
54
|
-
'This package typically was used during migration from RxJs version 5 to 6 during the Angular 5 ' +
|
|
55
|
-
'timeframe and may no longer be needed.\n' +
|
|
56
|
-
'Read more about this: https://rxjs-dev.firebaseapp.com/guide/v6/migration');
|
|
57
|
-
}
|
|
58
|
-
};
|
|
59
|
-
}
|
|
60
|
-
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,37 +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 dependencies_1 = require("../../utility/dependencies");
|
|
12
|
-
const workspace_1 = require("../../utility/workspace");
|
|
13
|
-
const workspace_models_1 = require("../../utility/workspace-models");
|
|
14
|
-
function default_1() {
|
|
15
|
-
return async (host) => {
|
|
16
|
-
const workspace = await (0, workspace_1.getWorkspace)(host);
|
|
17
|
-
for (const [, project] of workspace.projects) {
|
|
18
|
-
if (project.extensions.projectType !== workspace_models_1.ProjectType.Library) {
|
|
19
|
-
// Only interested in library projects
|
|
20
|
-
continue;
|
|
21
|
-
}
|
|
22
|
-
const packageJsonPath = (0, core_1.join)((0, core_1.normalize)(project.root), 'package.json');
|
|
23
|
-
if (!host.exists(packageJsonPath)) {
|
|
24
|
-
continue;
|
|
25
|
-
}
|
|
26
|
-
// Remove tslib from any type of dependency
|
|
27
|
-
(0, dependencies_1.removePackageJsonDependency)(host, 'tslib', packageJsonPath);
|
|
28
|
-
// Add tslib as a direct dependency
|
|
29
|
-
(0, dependencies_1.addPackageJsonDependency)(host, {
|
|
30
|
-
name: 'tslib',
|
|
31
|
-
version: '^2.0.0',
|
|
32
|
-
type: dependencies_1.NodeDependencyType.Default,
|
|
33
|
-
}, packageJsonPath);
|
|
34
|
-
}
|
|
35
|
-
};
|
|
36
|
-
}
|
|
37
|
-
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,119 +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
|
-
const workspace_1 = require("../../utility/workspace");
|
|
13
|
-
const workspace_models_1 = require("../../utility/workspace-models");
|
|
14
|
-
function default_1() {
|
|
15
|
-
return async (host, { logger }) => {
|
|
16
|
-
var _a;
|
|
17
|
-
// Workspace level tsconfig
|
|
18
|
-
try {
|
|
19
|
-
updateModuleAndTarget(host, 'tsconfig.json', {
|
|
20
|
-
oldModule: 'esnext',
|
|
21
|
-
newModule: 'es2020',
|
|
22
|
-
});
|
|
23
|
-
}
|
|
24
|
-
catch (error) {
|
|
25
|
-
logger.warn(`Unable to update 'tsconfig.json' module option from 'esnext' to 'es2020': ${error.message || error}`);
|
|
26
|
-
}
|
|
27
|
-
const workspace = await (0, workspace_1.getWorkspace)(host);
|
|
28
|
-
// Find all tsconfig which are refereces used by builders
|
|
29
|
-
for (const [, project] of workspace.projects) {
|
|
30
|
-
for (const [, target] of project.targets) {
|
|
31
|
-
// E2E builder doesn't reference a tsconfig but it uses one found in the root folder.
|
|
32
|
-
if (target.builder === workspace_models_1.Builders.Protractor &&
|
|
33
|
-
typeof ((_a = target.options) === null || _a === void 0 ? void 0 : _a.protractorConfig) === 'string') {
|
|
34
|
-
const tsConfigPath = (0, core_1.join)((0, core_1.dirname)((0, core_1.normalize)(target.options.protractorConfig)), 'tsconfig.json');
|
|
35
|
-
try {
|
|
36
|
-
updateModuleAndTarget(host, tsConfigPath, {
|
|
37
|
-
oldTarget: 'es5',
|
|
38
|
-
newTarget: 'es2018',
|
|
39
|
-
});
|
|
40
|
-
}
|
|
41
|
-
catch (error) {
|
|
42
|
-
logger.warn(`Unable to update '${tsConfigPath}' target option from 'es5' to 'es2018': ${error.message || error}`);
|
|
43
|
-
}
|
|
44
|
-
continue;
|
|
45
|
-
}
|
|
46
|
-
// Update all other known CLI builders that use a tsconfig
|
|
47
|
-
const tsConfigs = [target.options || {}, ...Object.values(target.configurations || {})]
|
|
48
|
-
.filter((opt) => typeof (opt === null || opt === void 0 ? void 0 : opt.tsConfig) === 'string')
|
|
49
|
-
.map((opt) => opt.tsConfig);
|
|
50
|
-
const uniqueTsConfigs = [...new Set(tsConfigs)];
|
|
51
|
-
if (uniqueTsConfigs.length < 1) {
|
|
52
|
-
continue;
|
|
53
|
-
}
|
|
54
|
-
switch (target.builder) {
|
|
55
|
-
case workspace_models_1.Builders.Server:
|
|
56
|
-
uniqueTsConfigs.forEach((p) => {
|
|
57
|
-
try {
|
|
58
|
-
updateModuleAndTarget(host, p, {
|
|
59
|
-
oldModule: 'commonjs',
|
|
60
|
-
// False will remove the module
|
|
61
|
-
// NB: For server we no longer use commonjs because it is bundled using webpack which has it's own module system.
|
|
62
|
-
// This ensures that lazy-loaded works on the server.
|
|
63
|
-
newModule: false,
|
|
64
|
-
});
|
|
65
|
-
}
|
|
66
|
-
catch (error) {
|
|
67
|
-
logger.warn(`Unable to remove '${p}' module option (was 'commonjs'): ${error.message || error}`);
|
|
68
|
-
}
|
|
69
|
-
try {
|
|
70
|
-
updateModuleAndTarget(host, p, {
|
|
71
|
-
newTarget: 'es2016',
|
|
72
|
-
});
|
|
73
|
-
}
|
|
74
|
-
catch (error) {
|
|
75
|
-
logger.warn(`Unable to update '${p}' target option to 'es2016': ${error.message || error}`);
|
|
76
|
-
}
|
|
77
|
-
});
|
|
78
|
-
break;
|
|
79
|
-
case workspace_models_1.Builders.Karma:
|
|
80
|
-
case workspace_models_1.Builders.Browser:
|
|
81
|
-
case workspace_models_1.Builders.DeprecatedNgPackagr:
|
|
82
|
-
uniqueTsConfigs.forEach((p) => {
|
|
83
|
-
try {
|
|
84
|
-
updateModuleAndTarget(host, p, {
|
|
85
|
-
oldModule: 'esnext',
|
|
86
|
-
newModule: 'es2020',
|
|
87
|
-
});
|
|
88
|
-
}
|
|
89
|
-
catch (error) {
|
|
90
|
-
logger.warn(`Unable to update '${p}' module option from 'esnext' to 'es2020': ${error.message || error}`);
|
|
91
|
-
}
|
|
92
|
-
});
|
|
93
|
-
break;
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
};
|
|
98
|
-
}
|
|
99
|
-
exports.default = default_1;
|
|
100
|
-
function updateModuleAndTarget(host, tsConfigPath, replacements) {
|
|
101
|
-
const json = new json_file_1.JSONFile(host, tsConfigPath);
|
|
102
|
-
const { oldTarget, newTarget, newModule, oldModule } = replacements;
|
|
103
|
-
if (newTarget) {
|
|
104
|
-
const target = json.get(['compilerOptions', 'target']);
|
|
105
|
-
if ((typeof target === 'string' && (!oldTarget || oldTarget === target.toLowerCase())) ||
|
|
106
|
-
!target) {
|
|
107
|
-
json.modify(['compilerOptions', 'target'], newTarget);
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
if (newModule === false) {
|
|
111
|
-
json.remove(['compilerOptions', 'module']);
|
|
112
|
-
}
|
|
113
|
-
else if (newModule) {
|
|
114
|
-
const module = json.get(['compilerOptions', 'module']);
|
|
115
|
-
if (typeof module === 'string' && oldModule === module.toLowerCase()) {
|
|
116
|
-
json.modify(['compilerOptions', 'module'], newModule);
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
}
|
|
@@ -1,10 +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 declare const TSLINT_VERSION = "~6.1.0";
|
|
10
|
-
export default function (): Rule;
|
|
@@ -1,122 +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
|
-
exports.TSLINT_VERSION = void 0;
|
|
11
|
-
const dependencies_1 = require("../../utility/dependencies");
|
|
12
|
-
const json_file_1 = require("../../utility/json-file");
|
|
13
|
-
exports.TSLINT_VERSION = '~6.1.0';
|
|
14
|
-
const TSLINT_CONFIG_PATH = '/tslint.json';
|
|
15
|
-
const RULES_TO_DELETE = ['no-use-before-declare', 'no-unused-variable'];
|
|
16
|
-
const RULES_TO_ADD = {
|
|
17
|
-
align: {
|
|
18
|
-
options: ['parameters', 'statements'],
|
|
19
|
-
},
|
|
20
|
-
'arrow-return-shorthand': true,
|
|
21
|
-
curly: true,
|
|
22
|
-
eofline: true,
|
|
23
|
-
'import-spacing': true,
|
|
24
|
-
indent: {
|
|
25
|
-
options: ['spaces'],
|
|
26
|
-
},
|
|
27
|
-
'variable-name': {
|
|
28
|
-
options: ['ban-keywords', 'check-format', 'allow-pascal-case'],
|
|
29
|
-
},
|
|
30
|
-
semicolon: { options: ['always'] },
|
|
31
|
-
'space-before-function-paren': {
|
|
32
|
-
options: {
|
|
33
|
-
anonymous: 'never',
|
|
34
|
-
asyncArrow: 'always',
|
|
35
|
-
constructor: 'never',
|
|
36
|
-
method: 'never',
|
|
37
|
-
named: 'never',
|
|
38
|
-
},
|
|
39
|
-
},
|
|
40
|
-
'typedef-whitespace': {
|
|
41
|
-
options: [
|
|
42
|
-
{
|
|
43
|
-
'call-signature': 'nospace',
|
|
44
|
-
'index-signature': 'nospace',
|
|
45
|
-
parameter: 'nospace',
|
|
46
|
-
'property-declaration': 'nospace',
|
|
47
|
-
'variable-declaration': 'nospace',
|
|
48
|
-
},
|
|
49
|
-
{
|
|
50
|
-
'call-signature': 'onespace',
|
|
51
|
-
'index-signature': 'onespace',
|
|
52
|
-
parameter: 'onespace',
|
|
53
|
-
'property-declaration': 'onespace',
|
|
54
|
-
'variable-declaration': 'onespace',
|
|
55
|
-
},
|
|
56
|
-
],
|
|
57
|
-
},
|
|
58
|
-
whitespace: {
|
|
59
|
-
options: [
|
|
60
|
-
'check-branch',
|
|
61
|
-
'check-decl',
|
|
62
|
-
'check-operator',
|
|
63
|
-
'check-separator',
|
|
64
|
-
'check-type',
|
|
65
|
-
'check-typecast',
|
|
66
|
-
],
|
|
67
|
-
},
|
|
68
|
-
};
|
|
69
|
-
function default_1() {
|
|
70
|
-
return (tree, context) => {
|
|
71
|
-
const logger = context.logger;
|
|
72
|
-
// Update tslint dependency
|
|
73
|
-
const current = (0, dependencies_1.getPackageJsonDependency)(tree, 'tslint');
|
|
74
|
-
if (!current) {
|
|
75
|
-
logger.info('"tslint" in not a dependency of this workspace.');
|
|
76
|
-
return;
|
|
77
|
-
}
|
|
78
|
-
if (current.version !== exports.TSLINT_VERSION) {
|
|
79
|
-
(0, dependencies_1.addPackageJsonDependency)(tree, {
|
|
80
|
-
type: current.type,
|
|
81
|
-
name: 'tslint',
|
|
82
|
-
version: exports.TSLINT_VERSION,
|
|
83
|
-
overwrite: true,
|
|
84
|
-
});
|
|
85
|
-
}
|
|
86
|
-
// Update tslint config.
|
|
87
|
-
let json;
|
|
88
|
-
try {
|
|
89
|
-
json = new json_file_1.JSONFile(tree, TSLINT_CONFIG_PATH);
|
|
90
|
-
}
|
|
91
|
-
catch {
|
|
92
|
-
const config = ['tslint.js', 'tslint.yaml'].find((c) => tree.exists(c));
|
|
93
|
-
if (config) {
|
|
94
|
-
logger.warn(`Expected a JSON configuration file but found "${config}".`);
|
|
95
|
-
}
|
|
96
|
-
else {
|
|
97
|
-
logger.warn('Cannot find "tslint.json" configuration file.');
|
|
98
|
-
}
|
|
99
|
-
return;
|
|
100
|
-
}
|
|
101
|
-
// Remove old/deprecated rules.
|
|
102
|
-
for (const rule of RULES_TO_DELETE) {
|
|
103
|
-
json.remove(['rules', rule]);
|
|
104
|
-
}
|
|
105
|
-
// Add new rules only iif the configuration extends 'tslint:recommended'.
|
|
106
|
-
// This is because some rules conflict with prettier or other tools.
|
|
107
|
-
const extend = json.get(['extends']);
|
|
108
|
-
if (extend !== 'tslint:recommended' ||
|
|
109
|
-
(Array.isArray(extend) && extend.some((e) => e.value !== 'tslint:recommended'))) {
|
|
110
|
-
logger.warn(`tslint configuration does not extend "tslint:recommended" or it extends multiple configurations.` +
|
|
111
|
-
'\nSkipping rule changes as some rules might conflict.');
|
|
112
|
-
return;
|
|
113
|
-
}
|
|
114
|
-
for (const [name, value] of Object.entries(RULES_TO_ADD)) {
|
|
115
|
-
const ruleName = ['rules', name];
|
|
116
|
-
if (json.get(ruleName) === undefined) {
|
|
117
|
-
json.modify(ruleName, value);
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
};
|
|
121
|
-
}
|
|
122
|
-
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,43 +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 json_file_1 = require("../../utility/json-file");
|
|
11
|
-
const workspace_1 = require("../../utility/workspace");
|
|
12
|
-
const workspace_models_1 = require("../../utility/workspace-models");
|
|
13
|
-
function default_1() {
|
|
14
|
-
return async (host) => {
|
|
15
|
-
var _a;
|
|
16
|
-
const workspace = await (0, workspace_1.getWorkspace)(host);
|
|
17
|
-
for (const [, project] of workspace.projects) {
|
|
18
|
-
for (const [, target] of project.targets) {
|
|
19
|
-
if (target.builder !== workspace_models_1.Builders.NgPackagr) {
|
|
20
|
-
continue;
|
|
21
|
-
}
|
|
22
|
-
if (!target.configurations) {
|
|
23
|
-
continue;
|
|
24
|
-
}
|
|
25
|
-
for (const options of Object.values(target.configurations)) {
|
|
26
|
-
addDeclarationMapValue(host, options === null || options === void 0 ? void 0 : options.tsConfig, false);
|
|
27
|
-
}
|
|
28
|
-
addDeclarationMapValue(host, (_a = target.options) === null || _a === void 0 ? void 0 : _a.tsConfig, true);
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
};
|
|
32
|
-
}
|
|
33
|
-
exports.default = default_1;
|
|
34
|
-
function addDeclarationMapValue(host, tsConfigPath, value) {
|
|
35
|
-
if (typeof tsConfigPath !== 'string') {
|
|
36
|
-
return;
|
|
37
|
-
}
|
|
38
|
-
const declarationMapPath = ['compilerOptions', 'declarationMap'];
|
|
39
|
-
const file = new json_file_1.JSONFile(host, tsConfigPath);
|
|
40
|
-
if (file.get(declarationMapPath) === undefined) {
|
|
41
|
-
file.modify(declarationMapPath, value);
|
|
42
|
-
}
|
|
43
|
-
}
|
|
@@ -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,37 +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 schematics_1 = require("@angular-devkit/schematics");
|
|
11
|
-
const dependencies_1 = require("../../utility/dependencies");
|
|
12
|
-
const latest_versions_1 = require("../../utility/latest-versions");
|
|
13
|
-
const workspace_1 = require("../../utility/workspace");
|
|
14
|
-
const workspace_models_1 = require("../../utility/workspace-models");
|
|
15
|
-
function default_1() {
|
|
16
|
-
return (0, schematics_1.chain)([
|
|
17
|
-
(0, workspace_1.updateWorkspace)((workspace) => {
|
|
18
|
-
for (const [, project] of workspace.projects) {
|
|
19
|
-
for (const [, target] of project.targets) {
|
|
20
|
-
if (target.builder === workspace_models_1.Builders.DeprecatedNgPackagr) {
|
|
21
|
-
target.builder = workspace_models_1.Builders.NgPackagr;
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
}),
|
|
26
|
-
(host) => {
|
|
27
|
-
(0, dependencies_1.removePackageJsonDependency)(host, '@angular-devkit/build-ng-packagr');
|
|
28
|
-
(0, dependencies_1.addPackageJsonDependency)(host, {
|
|
29
|
-
type: dependencies_1.NodeDependencyType.Dev,
|
|
30
|
-
name: '@angular-devkit/build-angular',
|
|
31
|
-
version: latest_versions_1.latestVersions.DevkitBuildAngular,
|
|
32
|
-
overwrite: false,
|
|
33
|
-
});
|
|
34
|
-
},
|
|
35
|
-
]);
|
|
36
|
-
}
|
|
37
|
-
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,77 +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
|
-
const optionsToRemove = {
|
|
15
|
-
environment: undefined,
|
|
16
|
-
extractCss: undefined,
|
|
17
|
-
tsconfigFileName: undefined,
|
|
18
|
-
rebaseRootRelativeCssUrls: undefined,
|
|
19
|
-
};
|
|
20
|
-
for (const [, project] of workspace.projects) {
|
|
21
|
-
for (const [, target] of project.targets) {
|
|
22
|
-
// Only interested in Angular Devkit builders
|
|
23
|
-
if (!(target === null || target === void 0 ? void 0 : target.builder.startsWith('@angular-devkit/build-angular'))) {
|
|
24
|
-
continue;
|
|
25
|
-
}
|
|
26
|
-
// Check options
|
|
27
|
-
if (target.options) {
|
|
28
|
-
target.options = {
|
|
29
|
-
...updateLazyScriptsStyleOption(target.options),
|
|
30
|
-
...optionsToRemove,
|
|
31
|
-
};
|
|
32
|
-
}
|
|
33
|
-
// Go through each configuration entry
|
|
34
|
-
if (!target.configurations) {
|
|
35
|
-
continue;
|
|
36
|
-
}
|
|
37
|
-
for (const configurationName of Object.keys(target.configurations)) {
|
|
38
|
-
target.configurations[configurationName] = {
|
|
39
|
-
...updateLazyScriptsStyleOption(target.configurations[configurationName]),
|
|
40
|
-
...optionsToRemove,
|
|
41
|
-
};
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
});
|
|
46
|
-
}
|
|
47
|
-
exports.default = default_1;
|
|
48
|
-
function updateLazyScriptsStyleOption(options) {
|
|
49
|
-
function visitor(options, type) {
|
|
50
|
-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
51
|
-
if (!options[type] || !(0, core_1.isJsonArray)(options[type])) {
|
|
52
|
-
return undefined;
|
|
53
|
-
}
|
|
54
|
-
const entries = [];
|
|
55
|
-
for (const entry of options[type]) {
|
|
56
|
-
if ((0, core_1.isJsonObject)(entry) && 'lazy' in entry) {
|
|
57
|
-
entries.push({
|
|
58
|
-
...entry,
|
|
59
|
-
inject: !entry.lazy,
|
|
60
|
-
lazy: undefined,
|
|
61
|
-
});
|
|
62
|
-
}
|
|
63
|
-
else {
|
|
64
|
-
entries.push(entry);
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
return entries;
|
|
68
|
-
}
|
|
69
|
-
if (!options) {
|
|
70
|
-
return undefined;
|
|
71
|
-
}
|
|
72
|
-
return {
|
|
73
|
-
...options,
|
|
74
|
-
styles: visitor(options, 'styles'),
|
|
75
|
-
scripts: visitor(options, 'scripts'),
|
|
76
|
-
};
|
|
77
|
-
}
|
|
@@ -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,44 +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 tasks_1 = require("@angular-devkit/schematics/tasks");
|
|
11
|
-
const dependencies_1 = require("../../utility/dependencies");
|
|
12
|
-
function default_1() {
|
|
13
|
-
return (host, context) => {
|
|
14
|
-
const dependenciesToUpdate = {
|
|
15
|
-
'@types/jasmine': '~3.6.0',
|
|
16
|
-
'codelyzer': '^6.0.0',
|
|
17
|
-
'jasmine-core': '~3.6.0',
|
|
18
|
-
'jasmine-spec-reporter': '~5.0.0',
|
|
19
|
-
'karma-chrome-launcher': '~3.1.0',
|
|
20
|
-
'karma-coverage': '~2.0.3',
|
|
21
|
-
'karma-jasmine': '~4.0.0',
|
|
22
|
-
'karma-jasmine-html-reporter': '^1.5.0',
|
|
23
|
-
'tslib': '^2.0.0',
|
|
24
|
-
};
|
|
25
|
-
let hasChanges = false;
|
|
26
|
-
for (const [name, version] of Object.entries(dependenciesToUpdate)) {
|
|
27
|
-
const current = (0, dependencies_1.getPackageJsonDependency)(host, name);
|
|
28
|
-
if (!current || current.version === version) {
|
|
29
|
-
continue;
|
|
30
|
-
}
|
|
31
|
-
(0, dependencies_1.addPackageJsonDependency)(host, {
|
|
32
|
-
type: current.type,
|
|
33
|
-
name,
|
|
34
|
-
version,
|
|
35
|
-
overwrite: true,
|
|
36
|
-
});
|
|
37
|
-
hasChanges = true;
|
|
38
|
-
}
|
|
39
|
-
if (hasChanges) {
|
|
40
|
-
context.addTask(new tasks_1.NodePackageInstallTask());
|
|
41
|
-
}
|
|
42
|
-
};
|
|
43
|
-
}
|
|
44
|
-
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;
|