UNPKG

dicebox

Version:

build tool for typescript based RPG Maker MV plugins

69 lines 2.85 kB
#!/usr/bin/env node "use strict"; var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } return new (P || (P = Promise))(function (resolve, reject) { function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; Object.defineProperty(exports, "__esModule", { value: true }); const argparse_1 = require("argparse"); const init_1 = require("./init"); const build_1 = require("./build"); const watch_1 = require("./watch"); function main() { return __awaiter(this, void 0, void 0, function* () { const argparser = new argparse_1.ArgumentParser(); const command = argparser.addSubparsers({ title: 'command', dest: 'command' }); const initCmd = command.addParser('init', { description: 'create a new rmmv plugin project' }); const buildCmd = command.addParser('build', { description: 'build plugin file in project directory' }); buildCmd.addArgument(['-o', '--out-dir'], { help: 'output directory to put the generated files in', defaultValue: 'dist' }); buildCmd.addArgument('file', { help: 'entry point file', defaultValue: 'src/index.ts' }); const watchCmd = command.addParser('watch', { description: 'watch and continuously build plugin file in project directory' }); watchCmd.addArgument(['-o', '--out-dir'], { help: 'output directory to put the generated files in', defaultValue: 'dist' }); watchCmd.addArgument('file', { help: 'entry point file', defaultValue: 'src/index.ts' }); const args = argparser.parseArgs(); switch (args.command) { case 'init': { yield init_1.init(); break; } case 'build': { yield build_1.build({ file: args.file, outDir: args.out_dir }); break; } case 'watch': { yield watch_1.watch({ file: args.file, outDir: args.out_dir }); break; } } }); } main() .then(() => process.exit(0)) .catch(err => { console.error(err); // tslint:disable-line process.exit(1); }); //# sourceMappingURL=cli.js.map