UNPKG

frontal

Version:

An Angular select/dropdown component

33 lines 1.27 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var schematics_1 = require("@angular-devkit/schematics"); /* istanbul ignore next */ function default_1() { return function (tree, context) { var pkgPath = '/package.json'; var buffer = tree.read(pkgPath); if (buffer == null) { throw new schematics_1.SchematicsException('Could not read package.json'); } var content = buffer.toString(); var pkg = JSON.parse(content); if (pkg === null || typeof pkg !== 'object' || Array.isArray(pkg)) { throw new schematics_1.SchematicsException('Error reading package.json'); } if (!pkg.dependencies) { pkg.dependencies = {}; } if (pkg.dependencies['frontal']) { var firstChar = pkg.dependencies['frontal'][0]; var suffix = match(firstChar, '^') || match(firstChar, '~'); pkg.dependencies['frontal'] = suffix + "3.0.1"; tree.overwrite(pkgPath, JSON.stringify(pkg, null, 2)); } return tree; }; } exports.default = default_1; function match(value, test) { return value === test ? test : ''; } //# sourceMappingURL=index.js.map