source: trip-planner-front/node_modules/@schematics/angular/migrations/update-11/add-declaration-map-compiler-option.js

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

initial commit

  • Property mode set to 100644
File size: 1.7 KB
RevLine 
[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 */
9Object.defineProperty(exports, "__esModule", { value: true });
10const json_file_1 = require("../../utility/json-file");
11const workspace_1 = require("../../utility/workspace");
12const workspace_models_1 = require("../../utility/workspace-models");
13function default_1() {
14 return async (host) => {
15 var _a;
16 const workspace = await 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}
33exports.default = default_1;
34function 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}
Note: See TracBrowser for help on using the repository browser.