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 tasks_1 = require("@angular-devkit/schematics/tasks");
|
---|
11 | const dependencies_1 = require("../../utility/dependencies");
|
---|
12 | function default_1() {
|
---|
13 | return (host, context) => {
|
---|
14 | const dependenciesToUpdate = {
|
---|
15 | '@types/jasmine': '~3.6.0',
|
---|
16 | 'codelyzer': '^6.0.0',
|
---|
17 | 'jasmine-core': '~3.6.0',
|
---|
18 | 'jasmine-spec-reporter': '~5.0.0',
|
---|
19 | 'karma-chrome-launcher': '~3.1.0',
|
---|
20 | 'karma-coverage': '~2.0.3',
|
---|
21 | 'karma-jasmine': '~4.0.0',
|
---|
22 | 'karma-jasmine-html-reporter': '^1.5.0',
|
---|
23 | 'tslib': '^2.0.0',
|
---|
24 | };
|
---|
25 | let hasChanges = false;
|
---|
26 | for (const [name, version] of Object.entries(dependenciesToUpdate)) {
|
---|
27 | const current = dependencies_1.getPackageJsonDependency(host, name);
|
---|
28 | if (!current || current.version === version) {
|
---|
29 | continue;
|
---|
30 | }
|
---|
31 | dependencies_1.addPackageJsonDependency(host, {
|
---|
32 | type: current.type,
|
---|
33 | name,
|
---|
34 | version,
|
---|
35 | overwrite: true,
|
---|
36 | });
|
---|
37 | hasChanges = true;
|
---|
38 | }
|
---|
39 | if (hasChanges) {
|
---|
40 | context.addTask(new tasks_1.NodePackageInstallTask());
|
---|
41 | }
|
---|
42 | };
|
---|
43 | }
|
---|
44 | exports.default = default_1;
|
---|