import * as fs from 'fs-extra'; import * as childProcess from 'child_process'; const ignored:string[] = [ "index.ts","index.d.ts", "BIFlowApplicationMain.ts","BIFlowApplicationMain.d.ts" ]; (async () => { try { // simpleFileIndex(); await remove('./lib/'); await exec('npm run core:build', './'); await copy('./lib', './dist'); await copy('./src/main/resources', './dist/resources/'); } catch (err) { console.log(err); } })(); function remove(loc: string): Promise { return new Promise((res, rej) => { return fs.remove(loc, (err) => { return (!!err ? rej(err) : res()); }); }); } function copy(src: string, dest: string): Promise { return new Promise((res, rej) => { return fs.copy(src, dest, (err) => { return (!!err ? rej(err) : res()); }); }); } function exec(cmd: string, loc: string): Promise { return new Promise((res, rej) => { return childProcess.exec(cmd, {cwd: loc}, (err, stdout, stderr) => { if (!!stdout) { console.log(stdout); } if (!!stderr) { console.log(stderr); } return (!!err ? rej(err) : res()); }); }); }