react-deploy
Version:
a deployment script for create react app to s3
13 lines (11 loc) • 588 B
JavaScript
function run(task, action, ...args) {
const command = process.argv[2];
const taskName = command && !command.startsWith('-') ? `${task}:${command}` : task;
const start = new Date();
process.stdout.write(`Starting '${taskName}'...\n`);
return Promise.resolve().then(() => action(...args)).then(() => {
process.stdout.write(`Finished '${taskName}' after ${new Date().getTime() - start.getTime()}ms\n`);
}, err => process.stderr.write(`${err.stack}\n`));
}
process.nextTick(() => require.main.exports());
module.exports = (task, action) => run.bind(undefined, task, action);