npmci/ts/index.ts

107 lines
2.3 KiB
TypeScript
Raw Permalink Normal View History

2016-11-24 22:21:40 +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)
2016-05-30 01:11:13 +00:00
2017-02-19 13:46:05 +00:00
import { build } from './npmci.build'
import { clean } from './npmci.clean'
import { command } from './npmci.command'
import { install } from './npmci.install'
import { publish } from './npmci.publish'
import { prepare } from './npmci.prepare'
import { test } from './npmci.test'
import { trigger } from './npmci.trigger'
2016-11-24 22:21:40 +00:00
import * as NpmciEnv from './npmci.env'
2016-05-26 20:17:57 +00:00
2017-02-19 13:46:05 +00:00
export { build } from './npmci.build'
export { install } from './npmci.install';
export { publish } from './npmci.publish';
2016-05-29 20:54:59 +00:00
2016-11-24 22:21:40 +00:00
let smartcli = new plugins.smartcli.Smartcli()
smartcli.addVersion(npmciInfo.version)
2016-06-25 09:58:33 +00:00
2016-06-25 10:28:51 +00:00
// build
2017-02-19 13:46:05 +00:00
smartcli.addCommand('build')
.then((argv) => {
build(argv._[ 1 ])
.then(NpmciEnv.configStore)
2017-05-15 16:10:24 +00:00
.catch(err => {
console.log(err)
2017-05-15 16:27:13 +00:00
process.exit(1)
2017-05-15 16:10:24 +00:00
})
2017-02-19 13:46:05 +00:00
})
2016-06-25 09:58:33 +00:00
2016-06-26 02:54:10 +00:00
// clean
2017-02-19 13:46:05 +00:00
smartcli.addCommand('clean')
.then((argv) => {
2016-06-26 02:54:10 +00:00
clean()
2017-02-19 13:46:05 +00:00
.then(NpmciEnv.configStore)
2017-05-15 16:27:13 +00:00
.catch(err => {
console.log(err)
process.exit(1)
})
2017-02-19 13:46:05 +00:00
})
2016-06-26 02:54:10 +00:00
2016-06-25 10:28:51 +00:00
// command
2017-02-19 13:46:05 +00:00
smartcli.addCommand('command')
.then((argv) => {
2016-06-25 10:28:51 +00:00
command()
2017-02-19 13:46:05 +00:00
.then(NpmciEnv.configStore)
2017-05-15 16:27:13 +00:00
.catch(err => {
console.log(err)
process.exit(1)
})
2017-02-19 13:46:05 +00:00
})
2016-05-29 20:54:59 +00:00
2016-06-25 10:28:51 +00:00
// install
2017-02-19 13:46:05 +00:00
smartcli.addCommand('install')
.then((argv) => {
install(argv._[ 1 ])
.then(NpmciEnv.configStore)
2017-05-15 16:27:13 +00:00
.catch(err => {
console.log(err)
process.exit(1)
})
2017-02-19 13:46:05 +00:00
})
2016-05-29 20:54:59 +00:00
2016-06-25 10:28:51 +00:00
// prepare
2017-02-19 13:46:05 +00:00
smartcli.addCommand('prepare')
.then((argv) => {
prepare(argv._[ 1 ])
.then(NpmciEnv.configStore)
2017-05-15 16:27:13 +00:00
.catch(err => {
console.log(err)
process.exit(1)
})
2017-02-19 13:46:05 +00:00
})
2016-06-25 10:28:51 +00:00
// publish
2017-02-19 13:46:05 +00:00
smartcli.addCommand('publish')
.then((argv) => {
publish(argv._[ 1 ])
.then(NpmciEnv.configStore)
2017-05-15 16:27:13 +00:00
.catch(err => {
console.log(err)
process.exit(1)
})
2017-02-19 13:46:05 +00:00
})
2016-06-25 10:28:51 +00:00
// test
2017-02-19 13:46:05 +00:00
smartcli.addCommand('test')
.then((argv) => {
test(argv._[ 1 ])
.then(NpmciEnv.configStore)
2017-05-15 16:27:13 +00:00
.catch(err => {
console.log(err)
process.exit(1)
})
2017-02-19 13:46:05 +00:00
})
2016-06-25 10:28:51 +00:00
// trigger
2017-02-19 13:46:05 +00:00
smartcli.addCommand('trigger')
.then((argv) => {
2016-11-24 22:21:40 +00:00
trigger()
2017-02-19 13:46:05 +00:00
})
2016-06-25 10:28:51 +00:00
2016-11-24 22:21:40 +00:00
smartcli.startParse()