[6a3a178] | 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 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 | }
|
---|