UNPKG

ngrx-vis

Version:

<p align="center"> <img src="https://github.com/co-IT/ngrx-vis/blob/master/assets/logo.png?raw=true"> </p>

32 lines (31 loc) 1.63 kB
#!/usr/bin/env node "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var commander_1 = require("commander"); var extract_actions_1 = require("./core/extract-actions"); var ngrx_vanilla_inspector_1 = require("./core/ngrx-vanilla-inspector"); var create_network_1 = require("./vis-js/create-network"); var create_web_view_1 = require("./web-view/create-web-view"); var program = new commander_1.Command(); program.version(process.env.npm_package_version || 'unknown'); program.option('-g, --glob <**/*.actions.ts>', 'Glob for files containing actions', '**/*.actions.ts'); program.requiredOption('-p, --project <path>', 'Specify path to tsconfig'); program.on('--help', function () { console.log(''); console.log('Example call:'); console.log(' $ ngrx-vis --project ./src/tsconfig.app.json'); }); program.parse(process.argv); var inspector = new ngrx_vanilla_inspector_1.NgRxVanillaInspector(program.project, program.glob); var actionContexts = inspector.inspect(); if (!(actionContexts === null || actionContexts === void 0 ? void 0 : actionContexts.length)) { console.log('📭 Sorry, no action declarations found'); console.log(' Please note that ngrx-vis is not capable of detecting actions in nested data structures, yet.'); } else { var actionsPlain = extract_actions_1.extractActions(actionContexts); var network = create_network_1.createNetwork(actionContexts); create_web_view_1.createWebView(actionsPlain, network) .then(function () { return console.log('✅ Graph created successfully'); }) .catch(function (err) { return console.log(err); }); }