UNPKG

tgomadev

Version:

A package to expediate and simplify tgoma game development

61 lines (47 loc) 1.58 kB
var program = require('commander'); var fse = require('fs-extra'); var path = require("path"); var local = path.join.bind(path, __dirname); // the path of the tgomadev pack directory const spawn = require('child_process').spawn; /* Command Format: tgomadev init tgomadev deploy tgomadev publish */ var cmd = process.argv[2] var version = fse.readJsonSync(local("package.json")).version; console.log("Tgoma Game Development tool - version: ", version) program .version(version) program .command("init [template]") .option('-I --create-tgomaproj-interactive', "Whether to make a project meta file") .option('-g --keep-git', "preserve templates git history") .action(function(template, options){ var template = template || "basic"; require("./commands/init.js")(template) }) program .command('build') .action(function(){ require("./commands/build.js")() }) program .command('emulate') .action(function(){ var out = fse.openSync(local('./out.log'), 'a'); var err = fse.openSync(local('./out.log'), 'a'); var child = spawn("java", ['-jar', local("core/Emulator_v27.jar")], {detached:true, stdio:['ignore', out, err]}) child.unref(); }) program .command("deploy") .action(function(options){ if(options.build){ require("./commands/build.js")() } require("./commands/deploy.js")() }) .option("--build") program.parse(process.argv);