@interaktiv/dia-scripts
Version:
CLI toolbox with common scripts for most sort of projects at DIA
31 lines (24 loc) • 628 B
JavaScript
;
const yargsParser = require('yargs-parser');
const watch = require('./watch');
const {
runDeploy
} = require('./runDeploy');
const _run = async (argv, onComplete = () => {}) => {
argv.watch ? await runWatch(argv) : await runWithoutWatch(argv, onComplete);
};
const runWatch = argv => watch({
argv
});
const runWithoutWatch = (argv, onComplete) => runDeploy({
argv,
onComplete
});
(async function () {
const rawArgv = process.argv.slice(2);
const argv = yargsParser(rawArgv);
let result;
await _run(argv, r => result = r);
if (argv.watch) return;
process.exitCode = result.status;
})();