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 | const latest_versions_1 = require("../../utility/latest-versions");
|
---|
13 | function default_1() {
|
---|
14 | return (host, context) => {
|
---|
15 | const dependenciesToUpdate = {
|
---|
16 | 'jasmine-core': '~3.5.0',
|
---|
17 | 'jasmine-spec-reporter': '~5.0.0',
|
---|
18 | 'karma': '~5.0.0',
|
---|
19 | 'karma-chrome-launcher': '~3.1.0',
|
---|
20 | 'karma-coverage-istanbul-reporter': '~3.0.2',
|
---|
21 | 'karma-jasmine': '~4.0.0',
|
---|
22 | 'karma-jasmine-html-reporter': '^1.5.0',
|
---|
23 | 'protractor': '~7.0.0',
|
---|
24 | 'ng-packagr': latest_versions_1.latestVersions['ng-packagr'],
|
---|
25 | 'tslib': '^2.0.0',
|
---|
26 | };
|
---|
27 | let hasChanges = false;
|
---|
28 | for (const [name, version] of Object.entries(dependenciesToUpdate)) {
|
---|
29 | const current = dependencies_1.getPackageJsonDependency(host, name);
|
---|
30 | if (!current || current.version === version) {
|
---|
31 | continue;
|
---|
32 | }
|
---|
33 | dependencies_1.addPackageJsonDependency(host, {
|
---|
34 | type: current.type,
|
---|
35 | name,
|
---|
36 | version,
|
---|
37 | overwrite: true,
|
---|
38 | });
|
---|
39 | hasChanges = true;
|
---|
40 | }
|
---|
41 | if (hasChanges) {
|
---|
42 | context.addTask(new tasks_1.NodePackageInstallTask());
|
---|
43 | }
|
---|
44 | // Check for @angular-devkit/schematics and @angular-devkit/core
|
---|
45 | for (const name of ['@angular-devkit/schematics', '@angular-devkit/core']) {
|
---|
46 | if (dependencies_1.getPackageJsonDependency(host, name)) {
|
---|
47 | context.logger.info(`Package "${name}" found in the workspace package.json. ` +
|
---|
48 | 'This package typically does not need to be installed manually. ' +
|
---|
49 | 'If it is not being used by project code, it can be removed from the package.json.');
|
---|
50 | }
|
---|
51 | }
|
---|
52 | if (dependencies_1.getPackageJsonDependency(host, 'rxjs-compat')) {
|
---|
53 | context.logger.info(`Package "rxjs-compat" found in the workspace package.json. ` +
|
---|
54 | 'This package typically was used during migration from RxJs version 5 to 6 during the Angular 5 ' +
|
---|
55 | 'timeframe and may no longer be needed.\n' +
|
---|
56 | 'Read more about this: https://rxjs-dev.firebaseapp.com/guide/v6/migration');
|
---|
57 | }
|
---|
58 | };
|
---|
59 | }
|
---|
60 | exports.default = default_1;
|
---|