2 Object.defineProperty(exports, "__esModule", { value: true });
3 var schematics_1 = require("@angular-devkit/schematics");
4 var tasks_1 = require("@angular-devkit/schematics/tasks");
5 var rxjsCompatVersion = '^6.0.0-rc.0';
6 function rxjsV6MigrationSchematic(_options) {
7 return function (tree, context) {
8 var pkgPath = '/package.json';
9 var buffer = tree.read(pkgPath);
11 throw new schematics_1.SchematicsException('Could not read package.json');
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');
18 if (!pkg.dependencies) {
19 pkg.dependencies = {};
21 pkg.dependencies['rxjs-compat'] = rxjsCompatVersion;
22 tree.overwrite(pkgPath, JSON.stringify(pkg, null, 2));
23 context.addTask(new tasks_1.NodePackageInstallTask());
27 exports.rxjsV6MigrationSchematic = rxjsV6MigrationSchematic;
28 //# sourceMappingURL=index.js.map