UNPKG

@ima/cli

Version:

IMA.js CLI tool to build, develop and work with IMA.js applications.

48 lines (47 loc) 1.77 kB
#!/usr/bin/env node "use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); const path_1 = __importDefault(require("path")); const chalk_1 = __importDefault(require("chalk")); const yargs_1 = __importDefault(require("yargs")); const helpers_1 = require("yargs/helpers"); // Normalize NODE_ENV switch (process.env.NODE_ENV) { case 'prod': process.env.NODE_ENV = 'production'; break; case 'dev': case undefined: process.env.NODE_ENV = 'development'; break; } // Init CLI (0, yargs_1.default)((0, helpers_1.hideBin)(process.argv)) .scriptName(chalk_1.default.green.bold('ima')) .usage('Usage: $0 <command>') .commandDir(path_1.default.resolve(__dirname, '../commands')) .demandCommand(1, 'You need to run at least one command to move on') .help() .updateStrings({ 'Examples:': chalk_1.default.bold.cyan('Examples:'), 'Options:': chalk_1.default.bold.cyan('Options:'), 'Commands:': chalk_1.default.bold.cyan('Commands:'), }) .updateLocale({ choices: chalk_1.default.gray('choices'), count: chalk_1.default.gray('count'), boolean: chalk_1.default.gray('boolean'), number: chalk_1.default.gray('number'), string: chalk_1.default.gray('string'), aliases: chalk_1.default.gray('aliases'), 'generated-value': chalk_1.default.gray('generated-value'), default: chalk_1.default.magenta('default'), required: chalk_1.default.yellow('required'), }) .wrap(null).argv; process.on('SIGTERM', () => process.exit(0)); process.on('SIGINT', () => process.exit(0)); process.on('SIGUSR2', () => process.exit(0));