UNPKG

@wbi/cli-service

Version:

local service for wb-cli projects

28 lines (25 loc) 703 B
module.exports = class Service { constructor (context) { this.initialized = false this.context = context this.commandUrls = { 'serve': '../build/dev-server-main', 'build': '../build/build', 'build-ftp': '../build/build-ftp', 'dll': '../build/build-dll', 'analyzer': '../build/analyzer' } this.command = null } init (commandName) { if (Object.keys(this.commandUrls).indexOf(commandName) < 0) { console.log(`Invalid command: ${commandName}`) process.exit(1) } this.command = require(this.commandUrls[commandName]) } async run (commandName, args = {}, rawArgv = []) { this.init(commandName) this.command() } }