ngrx-vis
Version:
<p align="center"> <img src="https://github.com/co-IT/ngrx-vis/blob/master/assets/logo.png?raw=true"> </p>
23 lines (22 loc) • 948 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
var fs_extra_1 = require("fs-extra");
function createWebView(actionsPlain, dataSet) {
return fs_extra_1.ensureDir('./ngrx-vis')
.then(function () { return fs_extra_1.copy(__dirname + "/template", './ngrx-vis/'); })
.then(function () {
return fs_extra_1.readFile('./ngrx-vis/src/network-graph.js', {
encoding: 'utf-8'
});
})
.then(function (graphJsFile) {
return graphJsFile
.replace('/* __ACTIONS_PLAIN__ */', JSON.stringify(actionsPlain))
.replace('/* __NETWORK_NODES__ */', JSON.stringify(dataSet.nodes))
.replace('/* __NETWORK_EDGES__ */', JSON.stringify(dataSet.edges));
})
.then(function (filledGraphJsFile) {
return fs_extra_1.writeFile('./ngrx-vis/src/network-graph.js', filledGraphJsFile);
});
}
exports.createWebView = createWebView;