[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 | exports.removeTsickle = void 0;
|
---|
| 11 | const dependencies_1 = require("../../utility/dependencies");
|
---|
| 12 | const json_file_1 = require("../../utility/json-file");
|
---|
| 13 | const workspace_1 = require("../../utility/workspace");
|
---|
| 14 | const workspace_models_1 = require("../../utility/workspace-models");
|
---|
| 15 | /**
|
---|
| 16 | * Remove tsickle from libraries
|
---|
| 17 | */
|
---|
| 18 | function removeTsickle() {
|
---|
| 19 | return async (tree, { logger }) => {
|
---|
| 20 | dependencies_1.removePackageJsonDependency(tree, 'tsickle');
|
---|
| 21 | const workspace = await workspace_1.getWorkspace(tree);
|
---|
| 22 | for (const [targetName, target] of workspace_1.allWorkspaceTargets(workspace)) {
|
---|
| 23 | if (targetName !== 'build' || target.builder !== workspace_models_1.Builders.DeprecatedNgPackagr) {
|
---|
| 24 | continue;
|
---|
| 25 | }
|
---|
| 26 | for (const [, options] of workspace_1.allTargetOptions(target)) {
|
---|
| 27 | const tsConfigPath = options.tsConfig;
|
---|
| 28 | if (!tsConfigPath || typeof tsConfigPath !== 'string') {
|
---|
| 29 | continue;
|
---|
| 30 | }
|
---|
| 31 | let tsConfigJson;
|
---|
| 32 | try {
|
---|
| 33 | tsConfigJson = new json_file_1.JSONFile(tree, tsConfigPath);
|
---|
| 34 | }
|
---|
| 35 | catch {
|
---|
| 36 | logger.warn(`Cannot find file: ${tsConfigPath}`);
|
---|
| 37 | continue;
|
---|
| 38 | }
|
---|
| 39 | tsConfigJson.remove(['angularCompilerOptions', 'annotateForClosureCompiler']);
|
---|
| 40 | }
|
---|
| 41 | }
|
---|
| 42 | };
|
---|
| 43 | }
|
---|
| 44 | exports.removeTsickle = removeTsickle;
|
---|