[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 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 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 = core_1.join(core_1.normalize(project.root), 'package.json');
|
---|
| 23 | if (!host.exists(packageJsonPath)) {
|
---|
| 24 | continue;
|
---|
| 25 | }
|
---|
| 26 | // Remove tslib from any type of dependency
|
---|
| 27 | dependencies_1.removePackageJsonDependency(host, 'tslib', packageJsonPath);
|
---|
| 28 | // Add tslib as a direct dependency
|
---|
| 29 | 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;
|
---|