source: trip-planner-front/node_modules/@schematics/angular/migrations/update-10/update-angular-config.js@ b738035

Last change on this file since b738035 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 3.7 KB
Line 
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 */
9Object.defineProperty(exports, "__esModule", { value: true });
10const core_1 = require("@angular-devkit/core");
11const workspace_1 = require("../../utility/workspace");
12const workspace_models_1 = require("../../utility/workspace-models");
13function default_1() {
14 return workspace_1.updateWorkspace((workspace) => {
15 // Remove deprecated CLI root level options
16 removeDeprecatedCLIOptions(workspace.extensions);
17 for (const [, project] of workspace.projects) {
18 // Project level
19 removeDeprecatedCLIOptions(project.extensions);
20 if (project.extensions.projectType !== workspace_models_1.ProjectType.Application) {
21 // Only interested in application projects since these changes only effects application builders
22 continue;
23 }
24 for (const [, target] of project.targets) {
25 // Only interested in Angular Devkit builders
26 if (!(target === null || target === void 0 ? void 0 : target.builder.startsWith('@angular-devkit/build-angular'))) {
27 continue;
28 }
29 let optionsToRemove = {
30 evalSourceMap: undefined,
31 skipAppShell: undefined,
32 profile: undefined,
33 elementExplorer: undefined,
34 };
35 if (target.builder === workspace_models_1.Builders.Server) {
36 optionsToRemove = {
37 ...optionsToRemove,
38 vendorChunk: undefined,
39 commonChunk: undefined,
40 };
41 }
42 // Check options
43 if (target.options) {
44 target.options = {
45 ...updateVendorSourceMap(target.options),
46 ...optionsToRemove,
47 };
48 }
49 // Go through each configuration entry
50 if (!target.configurations) {
51 continue;
52 }
53 for (const configurationName of Object.keys(target.configurations)) {
54 target.configurations[configurationName] = {
55 ...updateVendorSourceMap(target.configurations[configurationName]),
56 ...optionsToRemove,
57 };
58 }
59 }
60 }
61 });
62}
63exports.default = default_1;
64function updateVendorSourceMap(options) {
65 if (!options) {
66 return {};
67 }
68 const { vendorSourceMap: vendor, sourceMap = true } = options;
69 if (vendor === undefined) {
70 return options;
71 }
72 if (sourceMap === true) {
73 return {
74 ...options,
75 sourceMap: {
76 styles: true,
77 scripts: true,
78 vendor,
79 },
80 vendorSourceMap: undefined,
81 };
82 }
83 if (typeof sourceMap === 'object') {
84 return {
85 ...options,
86 sourceMap: {
87 ...sourceMap,
88 vendor,
89 },
90 vendorSourceMap: undefined,
91 };
92 }
93 return {
94 ...options,
95 vendorSourceMap: undefined,
96 };
97}
98function removeDeprecatedCLIOptions(extensions) {
99 const cliOptions = extensions === null || extensions === void 0 ? void 0 : extensions.cli;
100 if (cliOptions && core_1.isJsonObject(cliOptions) && core_1.isJsonObject(cliOptions.warnings)) {
101 cliOptions.warnings = {
102 ...cliOptions.warnings,
103 typescriptMismatch: undefined,
104 };
105 }
106}
Note: See TracBrowser for help on using the repository browser.