npmci/ts/index.ts

64 lines
1.5 KiB
TypeScript
Raw Permalink Normal View History

2016-05-26 20:17:57 +00:00
#!/usr/bin/env node
2016-05-29 20:54:59 +00:00
import "typings-global";
import * as plugins from "./npmci.plugins";
2016-05-26 20:17:57 +00:00
2016-05-30 01:19:07 +00:00
let packJson = require("../package.json");
2016-05-30 03:40:02 +00:00
plugins.beautylog.info("npmci version: " + packJson.version);
2016-05-30 01:11:13 +00:00
2016-06-02 23:58:37 +00:00
import {build} from "./npmci.build"
2016-05-30 00:28:47 +00:00
import {install} from "./npmci.install";
import {publish} from "./npmci.publish";
2016-06-02 11:08:15 +00:00
import {prepare} from "./npmci.prepare";
import {tag, retag} from "./npmci.tag";
2016-06-02 23:58:37 +00:00
import {test} from "./npmci.test";
2016-06-01 04:30:21 +00:00
import {trigger} from "./npmci.trigger";
2016-06-07 10:36:00 +00:00
import * as NpmciEnv from "./npmci.env";
2016-05-26 20:17:57 +00:00
2016-05-29 20:54:59 +00:00
let command;
let commandOption;
plugins.commander
2016-05-30 00:28:47 +00:00
.arguments('<commandarg> [commandoptionarg]')
.action(function (commandarg, commandoptionarg) {
command = commandarg;
commandOption = commandoptionarg;
2016-05-29 20:54:59 +00:00
});
2016-05-26 20:17:57 +00:00
2016-05-29 20:54:59 +00:00
plugins.commander.parse(process.argv);
2016-05-26 20:17:57 +00:00
2016-05-29 20:54:59 +00:00
if (typeof command === 'undefined') {
console.error('no command given!');
process.exit(1);
2016-05-26 20:17:57 +00:00
}
2016-05-29 20:54:59 +00:00
switch (command){
2016-06-02 23:58:37 +00:00
case "build":
2016-06-07 10:36:00 +00:00
build(commandOption)
.then(NpmciEnv.configStore);
2016-06-02 23:58:37 +00:00
break;
2016-05-29 20:54:59 +00:00
case "install":
2016-06-07 10:36:00 +00:00
install(commandOption)
.then(NpmciEnv.configStore);;
2016-05-30 00:28:47 +00:00
break;
2016-06-01 03:42:37 +00:00
case "prepare":
2016-06-07 10:36:00 +00:00
prepare(commandOption)
.then(NpmciEnv.configStore);;
2016-05-30 00:28:47 +00:00
break;
case "publish":
2016-06-07 10:36:00 +00:00
publish(commandOption)
.then(NpmciEnv.configStore);;
2016-05-30 00:28:47 +00:00
break;
2016-06-02 17:35:01 +00:00
case "test":
2016-06-07 10:36:00 +00:00
test(commandOption)
.then(NpmciEnv.configStore);
2016-06-02 17:35:01 +00:00
break;
case "trigger":
trigger();
break;
2016-05-30 00:28:47 +00:00
default:
break;
2016-05-29 20:54:59 +00:00
}