import * as minimist from 'minimist' import * as path from 'path' import {dwatch} from './lib/dwatch' import {Watcher} from "./lib/types/state"; import {webappServe} from "./lib/webserver"; process.on('uncaughtException', (err) => { // Dunno why this specific exception is not caught console.error(err.stack || err.message || err); process.exit(1); }); process.on('unhandledRejection', (err) => { // Dunno why this specific exception is not caught console.error(err.stack || err.message || err); process.exit(1); }); (async () => { const argv = minimist(process.argv.slice(2)) console.log('Starting...') try { const watchers: Watcher[] = await dwatch(argv.conf || path.join(__dirname, '../app.yml')) webappServe(watchers, argv.host, argv.port) } catch (e) { console.error(e) } })()