UNPKG

verbkit

Version:

verbkit game toolkit

46 lines (31 loc) 1.65 kB
#! /usr/bin/env node var shell = require('shelljs'); var args = require('yargs'); var argv = args.usage("$0 command").command("create", "Creates a new verbkit project").argv; var desktopDir = ((process.platform == "win32") ? "~/Desktop" : "~/Desktop"); var cpCmd = ((process.platform == "win32")) ? "copy" : "cp"; var projectDir = ""; if(argv._[0] === "init") { } else if(argv._[0] === "create") { if(argv._[1] !== "" || arv._[1] !== undefined) { projectDir = desktopDir + ("/" + argv._[1]); shell.exec("echo 'Making project " + argv._[1] + " ...' && mkdir " + projectDir); shell.exec("cp " + __dirname + "/app_content/index.ts " + projectDir); shell.exec("cp -R " + __dirname + "/app_content/html " + (projectDir + "/html")); shell.exec("cp -R " + __dirname + "/app_content/typescript " + (projectDir + "/typescript")); shell.exec("echo 'Done! To run game, type \"verbkit run " + argv._[1] + "\"'"); } } else if(argv._[0] === "run") { shell.exec("verbkit build " + argv._[1] + " && verbkit test " + argv._[1]); } else if(argv._[0] === "build") { if(argv._[1] !== undefined) { projectDir = desktopDir + "/" + argv._[1]; } var execFile = projectDir + "/index.ts"; var outputFile = projectDir + "/html/game.js"; var compile = ("tsc " + execFile + " --out " + outputFile); var command = compile; shell.exec(command); } else if(argv._[0] === "test") { if(argv._[1] !== undefined) { projectDir = desktopDir + "/" + argv._[1]; } var execFile = projectDir + "/index.ts"; shell.exec("nohup http-server " + projectDir + "/html -o -s -c-1"); }