2017-01-17 23:58:09 +00:00
|
|
|
import * as q from 'smartq'
|
2016-10-21 15:48:52 +00:00
|
|
|
|
2016-10-06 19:03:30 +00:00
|
|
|
import * as plugins from './npmts.plugins'
|
|
|
|
import * as paths from './npmts.paths'
|
2016-10-21 15:48:52 +00:00
|
|
|
import * as NpmtsConfig from './npmts.config'
|
|
|
|
import * as NpmtsMods from './npmts.mods'
|
|
|
|
import * as NpmtsWatch from './npmts.watch'
|
|
|
|
import * as NpmtsShip from './npmts.ship'
|
|
|
|
|
2016-10-06 19:03:30 +00:00
|
|
|
export let run = () => {
|
|
|
|
let done = q.defer()
|
|
|
|
let npmtsProjectInfo = new plugins.projectinfo.ProjectinfoNpm(paths.npmtsPackageRoot)
|
|
|
|
let npmtsCli = new plugins.smartcli.Smartcli()
|
|
|
|
npmtsCli.standardTask()
|
|
|
|
.then((argvArg) => {
|
|
|
|
plugins.beautylog.figletSync('NPMTS')
|
|
|
|
plugins.beautylog.info('npmts version: ' + npmtsProjectInfo.version)
|
2016-10-21 15:48:52 +00:00
|
|
|
return NpmtsConfig.run(argvArg)
|
|
|
|
})
|
|
|
|
.then((configArg: NpmtsConfig.INpmtsConfig) => {
|
|
|
|
let done = q.defer()
|
2017-01-21 22:23:00 +00:00
|
|
|
plugins.beautylog.ora.start('loading additional modules...')
|
2016-10-21 15:48:52 +00:00
|
|
|
NpmtsMods.mod00.load()
|
|
|
|
.then((mod00) => {
|
|
|
|
return mod00.run(configArg)
|
|
|
|
})
|
|
|
|
.then(configArg => {
|
|
|
|
let done = q.defer<NpmtsConfig.INpmtsConfig>()
|
|
|
|
NpmtsMods.mod01.load()
|
|
|
|
.then(mod01 => {
|
|
|
|
return mod01.run(configArg)
|
|
|
|
})
|
|
|
|
.then(configArg => {
|
|
|
|
done.resolve(configArg)
|
|
|
|
})
|
|
|
|
return done.promise
|
|
|
|
})
|
|
|
|
.then(configArg => {
|
|
|
|
let done = q.defer<NpmtsConfig.INpmtsConfig>()
|
|
|
|
NpmtsMods.mod02.load()
|
|
|
|
.then(mod02 => {
|
|
|
|
return mod02.run(configArg)
|
|
|
|
})
|
|
|
|
.then(configArg => {
|
|
|
|
done.resolve(configArg)
|
|
|
|
})
|
|
|
|
return done.promise
|
|
|
|
})
|
|
|
|
.then(NpmtsWatch.run)
|
|
|
|
.then(NpmtsShip.run)
|
|
|
|
|
|
|
|
return done.promise
|
2016-10-06 19:03:30 +00:00
|
|
|
})
|
2016-10-21 23:34:07 +00:00
|
|
|
.catch((err) => { if (err instanceof Error) { console.log(err) } } )
|
2016-10-06 19:03:30 +00:00
|
|
|
npmtsCli.addVersion(npmtsProjectInfo.version)
|
|
|
|
npmtsCli.startParse()
|
|
|
|
return done.promise
|
|
|
|
}
|