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.updateDependencies = void 0;
|
---|
11 | const dependencies_1 = require("../../utility/dependencies");
|
---|
12 | function updateDependencies() {
|
---|
13 | return (host, context) => {
|
---|
14 | const dependenciesToUpdate = {
|
---|
15 | '@angular-devkit/build-angular': '~0.901.15',
|
---|
16 | '@angular-devkit/build-ng-packagr': '~0.901.15',
|
---|
17 | '@angular-devkit/build-webpack': '~0.901.15',
|
---|
18 | 'zone.js': '~0.10.0',
|
---|
19 | 'ng-packagr': '^9.0.0',
|
---|
20 | 'web-animations-js': '^2.3.2',
|
---|
21 | 'codelyzer': '^5.1.2',
|
---|
22 | '@types/node': '^12.11.1',
|
---|
23 | };
|
---|
24 | for (const [name, version] of Object.entries(dependenciesToUpdate)) {
|
---|
25 | const current = dependencies_1.getPackageJsonDependency(host, name);
|
---|
26 | if (!current || current.version === version) {
|
---|
27 | continue;
|
---|
28 | }
|
---|
29 | dependencies_1.addPackageJsonDependency(host, {
|
---|
30 | type: current.type,
|
---|
31 | name,
|
---|
32 | version,
|
---|
33 | overwrite: true,
|
---|
34 | });
|
---|
35 | }
|
---|
36 | // `@angular/pwa` package is only needed when running `ng-add`.
|
---|
37 | dependencies_1.removePackageJsonDependency(host, '@angular/pwa');
|
---|
38 | // Check for @angular-devkit/schematics and @angular-devkit/core
|
---|
39 | for (const name of ['@angular-devkit/schematics', '@angular-devkit/core']) {
|
---|
40 | const current = dependencies_1.getPackageJsonDependency(host, name);
|
---|
41 | if (current) {
|
---|
42 | context.logger.info(`Package "${name}" found in the workspace package.json. ` +
|
---|
43 | 'This package typically does not need to be installed manually. ' +
|
---|
44 | 'If it is not being used by project code, it can be removed from the package.json.');
|
---|
45 | }
|
---|
46 | }
|
---|
47 | };
|
---|
48 | }
|
---|
49 | exports.updateDependencies = updateDependencies;
|
---|