UNPKG

@dlr-eoc/core-ui

Version:

This project includes schematics to add the base UKIS-Layout to an angular application. The Layout is based on Clarity so [add this first](https://clarity.design/get-started/developing/angular)!

26 lines 853 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.updateJsonFile = updateJsonFile; const schematics_1 = require("@angular-devkit/schematics"); const jsonc_parser_1 = require("jsonc-parser"); /** * Update a JSON File * * The callback function gets the actual file */ function updateJsonFile(path, cb) { return (tree) => { if (!tree.exists(path)) { throw new schematics_1.SchematicsException(`${path} is not in the workspace!`); } const source = tree.read(path); if (source) { const sourceText = source.toString('utf-8'); let json = (0, jsonc_parser_1.parse)(sourceText); json = cb(json); tree.overwrite(path, JSON.stringify(json, null, 2)); } return tree; }; } //# sourceMappingURL=json-utils.js.map