2017-05-18 20:40:09 +00:00
|
|
|
import * as plugins from './npmci.plugins'
|
|
|
|
import * as paths from './npmci.paths'
|
|
|
|
let npmciInfo = new plugins.projectinfo.ProjectinfoNpm(paths.NpmciPackageRoot)
|
|
|
|
plugins.beautylog.log('npmci version: ' + npmciInfo.version)
|
|
|
|
|
|
|
|
import * as NpmciEnv from './npmci.env'
|
|
|
|
|
|
|
|
import * as npmciMods from './npmci.mods'
|
|
|
|
|
|
|
|
let smartcli = new plugins.smartcli.Smartcli()
|
|
|
|
smartcli.addVersion(npmciInfo.version)
|
|
|
|
|
|
|
|
// build
|
|
|
|
smartcli.addCommand('build')
|
2017-07-27 12:20:56 +00:00
|
|
|
.then(async (argvArg) => {
|
2017-05-18 20:40:09 +00:00
|
|
|
let modBuild = await npmciMods.modBuild.load()
|
2017-07-27 12:20:56 +00:00
|
|
|
await modBuild.build(argvArg)
|
2017-05-18 20:40:09 +00:00
|
|
|
NpmciEnv.configStore()
|
|
|
|
}).catch(err => {
|
|
|
|
console.log(err)
|
|
|
|
process.exit(1)
|
|
|
|
})
|
|
|
|
|
|
|
|
// clean
|
|
|
|
smartcli.addCommand('clean')
|
|
|
|
.then(async (argv) => {
|
|
|
|
let modClean = await npmciMods.modClean.load()
|
|
|
|
await modClean.clean()
|
|
|
|
await NpmciEnv.configStore()
|
|
|
|
}).catch(err => {
|
|
|
|
console.log(err)
|
|
|
|
process.exit(1)
|
|
|
|
})
|
|
|
|
|
|
|
|
// command
|
|
|
|
smartcli.addCommand('command')
|
|
|
|
.then(async (argv) => {
|
|
|
|
let modCommand = await npmciMods.modCommand.load()
|
|
|
|
await modCommand.command()
|
|
|
|
await NpmciEnv.configStore()
|
|
|
|
}).catch(err => {
|
|
|
|
console.log(err)
|
|
|
|
process.exit(1)
|
|
|
|
})
|
|
|
|
|
2017-06-07 13:16:33 +00:00
|
|
|
// purge
|
|
|
|
smartcli.addCommand('purge')
|
|
|
|
.then(async (argvArg) => {
|
|
|
|
let modPurge = await npmciMods.modPurge.load()
|
|
|
|
await modPurge.purge(argvArg)
|
|
|
|
}).catch(err => {
|
|
|
|
console.log(err)
|
|
|
|
})
|
|
|
|
|
2017-05-18 20:40:09 +00:00
|
|
|
// install
|
|
|
|
smartcli.addCommand('install')
|
|
|
|
.then(async (argv) => {
|
|
|
|
let modInstall = await npmciMods.modInstall.load()
|
|
|
|
await modInstall.install(argv._[1])
|
|
|
|
await NpmciEnv.configStore()
|
|
|
|
}).catch(err => {
|
|
|
|
console.log(err)
|
|
|
|
process.exit(1)
|
|
|
|
})
|
|
|
|
|
|
|
|
// prepare
|
|
|
|
smartcli.addCommand('prepare')
|
|
|
|
.then(async (argv) => {
|
|
|
|
let modPrepare = await npmciMods.modPrepare.load()
|
|
|
|
await modPrepare.prepare(argv._[1])
|
|
|
|
await NpmciEnv.configStore()
|
|
|
|
}).catch(err => {
|
|
|
|
console.log(err)
|
|
|
|
process.exit(1)
|
|
|
|
})
|
|
|
|
|
|
|
|
// publish
|
|
|
|
smartcli.addCommand('publish')
|
2017-07-27 11:15:39 +00:00
|
|
|
.then(async (argvArg) => {
|
2017-05-18 20:40:09 +00:00
|
|
|
let modPublish = await npmciMods.modPublish.load()
|
2017-07-27 11:15:39 +00:00
|
|
|
await modPublish.publish(argvArg)
|
2017-05-18 20:40:09 +00:00
|
|
|
await NpmciEnv.configStore()
|
|
|
|
|
|
|
|
}).catch(err => {
|
|
|
|
console.log(err)
|
|
|
|
process.exit(1)
|
|
|
|
})
|
|
|
|
|
|
|
|
// test
|
|
|
|
smartcli.addCommand('test')
|
|
|
|
.then(async (argv) => {
|
|
|
|
let modTest = await npmciMods.modTest.load()
|
2017-07-27 12:20:56 +00:00
|
|
|
await modTest.test(argv)
|
2017-05-18 20:40:09 +00:00
|
|
|
await NpmciEnv.configStore()
|
|
|
|
}).catch(err => {
|
|
|
|
console.log(err)
|
|
|
|
process.exit(1)
|
|
|
|
})
|
|
|
|
|
|
|
|
// trigger
|
|
|
|
smartcli.addCommand('trigger')
|
|
|
|
.then(async (argv) => {
|
|
|
|
let modTrigger = await npmciMods.modTrigger.load()
|
|
|
|
await modTrigger.trigger()
|
|
|
|
await NpmciEnv.configStore()
|
|
|
|
}).catch(err => {
|
|
|
|
console.log(err)
|
|
|
|
process.exit(1)
|
|
|
|
})
|
|
|
|
|
|
|
|
smartcli.startParse()
|