UNPKG

1.17 kBJavaScriptView Raw
1"use strict";
2Object.defineProperty(exports, "__esModule", { value: true });
3var schematics_1 = require("@angular-devkit/schematics");
4var tasks_1 = require("@angular-devkit/schematics/tasks");
5var rxjsCompatVersion = '^6.0.0-rc.0';
6function rxjsV6MigrationSchematic(_options) {
7 return function (tree, context) {
8 var pkgPath = '/package.json';
9 var buffer = tree.read(pkgPath);
10 if (buffer == null) {
11 throw new schematics_1.SchematicsException('Could not read package.json');
12 }
13 var content = buffer.toString();
14 var pkg = JSON.parse(content);
15 if (pkg === null || typeof pkg !== 'object' || Array.isArray(pkg)) {
16 throw new schematics_1.SchematicsException('Error reading package.json');
17 }
18 if (!pkg.dependencies) {
19 pkg.dependencies = {};
20 }
21 pkg.dependencies['rxjs-compat'] = rxjsCompatVersion;
22 tree.overwrite(pkgPath, JSON.stringify(pkg, null, 2));
23 context.addTask(new tasks_1.NodePackageInstallTask());
24 return tree;
25 };
26}
27exports.rxjsV6MigrationSchematic = rxjsV6MigrationSchematic;
28//# sourceMappingURL=index.js.map
\No newline at end of file