npmci/ts/npmci.cli.ts

115 lines
2.5 KiB
TypeScript
Raw Permalink Normal View History

2018-04-04 20:25:13 +00:00
import * as plugins from './npmci.plugins';
import * as paths from './npmci.paths';
import * as npmciMonitor from './npmci.monitor';
npmciMonitor.run();
2017-09-08 12:58:44 +00:00
// Get Info about npmci itself
2018-04-04 20:25:13 +00:00
let npmciInfo = new plugins.projectinfo.ProjectinfoNpm(paths.NpmciPackageRoot);
plugins.beautylog.log('npmci version: ' + npmciInfo.version);
2017-05-18 20:40:09 +00:00
2018-04-04 20:25:13 +00:00
import * as NpmciEnv from './npmci.env';
2017-05-18 20:40:09 +00:00
2018-04-04 20:25:13 +00:00
import * as npmciMods from './npmci.mods';
2017-05-18 20:40:09 +00:00
2018-05-04 13:58:11 +00:00
const npmciSmartcli = new plugins.smartcli.Smartcli();
npmciSmartcli.addVersion(npmciInfo.version);
2017-05-18 20:40:09 +00:00
// clean
2018-05-04 13:58:11 +00:00
npmciSmartcli
2018-04-04 20:25:13 +00:00
.addCommand('clean')
2018-05-04 13:58:11 +00:00
.subscribe(async argv => {
2018-04-04 20:25:13 +00:00
let modClean = await npmciMods.modClean.load();
await modClean.clean();
2018-05-04 13:58:11 +00:00
}, err => {
2018-04-04 20:25:13 +00:00
console.log(err);
process.exit(1);
});
2017-05-18 20:40:09 +00:00
2017-08-27 13:24:17 +00:00
// cloudflare
2018-05-04 13:58:11 +00:00
npmciSmartcli
2018-04-04 20:25:13 +00:00
.addCommand('cloudflare')
2018-05-04 13:58:11 +00:00
.subscribe(async argvArg => {
2018-04-04 20:25:13 +00:00
let modPurge = await npmciMods.modCloudflare.load();
await modPurge.handleCli(argvArg);
2018-05-04 13:58:11 +00:00
}, err => {
2018-04-04 20:25:13 +00:00
console.log(err);
});
2017-08-27 13:24:17 +00:00
2017-05-18 20:40:09 +00:00
// command
2018-05-04 13:58:11 +00:00
npmciSmartcli
2018-04-04 20:25:13 +00:00
.addCommand('command')
2018-05-04 13:58:11 +00:00
.subscribe(async argv => {
2018-04-04 20:25:13 +00:00
let modCommand = await npmciMods.modCommand.load();
await modCommand.command();
2018-05-04 13:58:11 +00:00
}, err => {
2018-04-04 20:25:13 +00:00
console.log(err);
process.exit(1);
});
2017-05-18 20:40:09 +00:00
2017-09-08 12:58:44 +00:00
// command
2018-05-04 13:58:11 +00:00
npmciSmartcli
2018-04-04 20:25:13 +00:00
.addCommand('git')
2018-05-04 13:58:11 +00:00
.subscribe(async argvArg => {
2018-04-04 20:25:13 +00:00
let modGit = await npmciMods.modGit.load();
await modGit.handleCli(argvArg);
2018-05-04 13:58:11 +00:00
}, err => {
2018-04-04 20:25:13 +00:00
console.log(err);
process.exit(1);
});
2017-09-08 12:58:44 +00:00
2017-08-27 13:24:17 +00:00
// build
2018-05-04 13:58:11 +00:00
npmciSmartcli
2018-04-04 20:25:13 +00:00
.addCommand('docker')
2018-05-04 13:58:11 +00:00
.subscribe(async argvArg => {
2018-04-04 20:25:13 +00:00
let modDocker = await npmciMods.modDocker.load();
await modDocker.handleCli(argvArg);
2018-05-04 13:58:11 +00:00
}, err => {
2018-04-04 20:25:13 +00:00
console.log(err);
process.exit(1);
});
2017-05-18 20:40:09 +00:00
2017-08-27 13:24:17 +00:00
// node
2018-05-04 13:58:11 +00:00
npmciSmartcli
2018-04-04 20:25:13 +00:00
.addCommand('node')
2018-05-04 13:58:11 +00:00
.subscribe(async argvArg => {
2018-04-04 20:25:13 +00:00
let modNode = await npmciMods.modNode.load();
await modNode.handleCli(argvArg);
2018-05-04 13:58:11 +00:00
}, err => {
2018-04-04 20:25:13 +00:00
console.log(err);
2018-05-04 13:58:11 +00:00
process.exit(1);
2018-04-04 20:25:13 +00:00
});
2017-05-18 20:40:09 +00:00
2017-08-27 13:24:17 +00:00
// npm
2018-05-04 13:58:11 +00:00
npmciSmartcli
2018-04-04 20:25:13 +00:00
.addCommand('npm')
2018-05-04 13:58:11 +00:00
.subscribe(async argvArg => {
2018-04-04 20:25:13 +00:00
let modNpm = await npmciMods.modNpm.load();
await modNpm.handleCli(argvArg);
2018-05-04 13:58:11 +00:00
}, err => {
2018-04-04 20:25:13 +00:00
console.log(err);
});
2017-05-18 20:40:09 +00:00
2017-08-27 13:24:17 +00:00
// trigger
2018-05-04 13:58:11 +00:00
npmciSmartcli
2018-04-04 20:25:13 +00:00
.addCommand('ssh')
2018-05-04 13:58:11 +00:00
.subscribe(async argvArg => {
2018-04-04 20:25:13 +00:00
let modSsh = await npmciMods.modSsh.load();
await modSsh.handleCli(argvArg);
2018-05-04 13:58:11 +00:00
}, err => {
2018-04-04 20:25:13 +00:00
console.log(err);
process.exit(1);
});
2017-05-18 20:40:09 +00:00
// trigger
2018-05-04 13:58:11 +00:00
npmciSmartcli
2018-04-04 20:25:13 +00:00
.addCommand('trigger')
2018-05-04 13:58:11 +00:00
.subscribe(async argv => {
2018-04-04 20:25:13 +00:00
let modTrigger = await npmciMods.modTrigger.load();
await modTrigger.trigger();
2018-05-04 13:58:11 +00:00
}, err => {
2018-04-04 20:25:13 +00:00
console.log(err);
process.exit(1);
});
2017-05-18 20:40:09 +00:00
2018-05-04 13:58:11 +00:00
npmciSmartcli.startParse();