elm-spa
Version:
single page apps made easy
35 lines (34 loc) • 1.01 kB
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const cli_1 = __importDefault(require("./cli"));
const commands = {
new: cli_1.default.new,
add: cli_1.default.add,
build: cli_1.default.build,
gen: cli_1.default.gen,
watch: cli_1.default.watch,
server: cli_1.default.server,
help: cli_1.default.help,
// Aliases for Elm folks
init: cli_1.default.new,
make: cli_1.default.build,
};
const command = process.argv[2];
Promise.resolve(command)
.then(cmd => commands[cmd] || commands.help)
.then(task => task())
.then(output => {
const message = output instanceof Array ? output : [output];
console.info('');
console.info(message.join('\n\n'));
})
.catch(reason => {
console.info('');
console.error(reason);
console.info('');
process.exit(1);
});