UNPKG

933 BJavaScriptView Raw
1"use strict";
2
3var _lodash = _interopRequireDefault(require("lodash"));
4
5var _fs = _interopRequireDefault(require("fs"));
6
7var _angularDefaults = _interopRequireDefault(require("../defaults/angular-defaults"));
8
9function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
10
11const exec = require('child-process-promise').exec;
12
13module.exports = name => {
14 // Replace placeholders with appName
15 const defaultsConfigString = _lodash.default.template(JSON.stringify(_angularDefaults.default))({
16 'appName': name
17 }); // Read the current angular.json && merge with our defaults
18
19
20 return exec('cat angular.json').then(result => {
21 const newConfig = _lodash.default.merge(JSON.parse(result.stdout), JSON.parse(defaultsConfigString)); // white the file
22
23
24 _fs.default.writeFileSync('angular.json', JSON.stringify(newConfig)); // format the file
25
26
27 exec(`json -I -f angular.json`);
28 });
29};
\No newline at end of file