2018-11-24 14:00:19 +00:00
|
|
|
import { logger } from './npmci.logging';
|
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-11-24 14:00:19 +00:00
|
|
|
const npmciInfo = new plugins.projectinfo.ProjectinfoNpm(paths.NpmciPackageRoot);
|
|
|
|
logger.log('info', '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-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-07 08:51:45 +00:00
|
|
|
npmciSmartcli.addCommand('clean').subscribe(
|
|
|
|
async argv => {
|
2018-11-24 14:00:19 +00:00
|
|
|
const modClean = await import('./mod_clean/index');
|
2018-04-04 20:25:13 +00:00
|
|
|
await modClean.clean();
|
2018-05-07 08:51:45 +00:00
|
|
|
},
|
|
|
|
err => {
|
2018-04-04 20:25:13 +00:00
|
|
|
console.log(err);
|
|
|
|
process.exit(1);
|
2018-05-07 08:51:45 +00:00
|
|
|
}
|
|
|
|
);
|
2017-05-18 20:40:09 +00:00
|
|
|
|
|
|
|
// command
|
2018-05-07 08:51:45 +00:00
|
|
|
npmciSmartcli.addCommand('command').subscribe(
|
|
|
|
async argv => {
|
2018-11-24 14:00:19 +00:00
|
|
|
const modCommand = await import('./mod_command/index');
|
2018-04-04 20:25:13 +00:00
|
|
|
await modCommand.command();
|
2018-05-07 08:51:45 +00:00
|
|
|
},
|
|
|
|
err => {
|
2018-04-04 20:25:13 +00:00
|
|
|
console.log(err);
|
|
|
|
process.exit(1);
|
2018-05-07 08:51:45 +00:00
|
|
|
}
|
|
|
|
);
|
2017-05-18 20:40:09 +00:00
|
|
|
|
2017-09-08 12:58:44 +00:00
|
|
|
// command
|
2018-05-07 08:51:45 +00:00
|
|
|
npmciSmartcli.addCommand('git').subscribe(
|
|
|
|
async argvArg => {
|
2018-11-24 14:00:19 +00:00
|
|
|
const modGit = await import('./mod_git/index');
|
2018-04-04 20:25:13 +00:00
|
|
|
await modGit.handleCli(argvArg);
|
2018-05-07 08:51:45 +00:00
|
|
|
},
|
|
|
|
err => {
|
2018-04-04 20:25:13 +00:00
|
|
|
console.log(err);
|
|
|
|
process.exit(1);
|
2018-05-07 08:51:45 +00:00
|
|
|
}
|
|
|
|
);
|
2017-09-08 12:58:44 +00:00
|
|
|
|
2017-08-27 13:24:17 +00:00
|
|
|
// build
|
2018-05-07 08:51:45 +00:00
|
|
|
npmciSmartcli.addCommand('docker').subscribe(
|
|
|
|
async argvArg => {
|
2018-11-24 14:00:19 +00:00
|
|
|
const modDocker = await import('./mod_docker/index');
|
2018-04-04 20:25:13 +00:00
|
|
|
await modDocker.handleCli(argvArg);
|
2018-05-07 08:51:45 +00:00
|
|
|
},
|
|
|
|
err => {
|
2018-04-04 20:25:13 +00:00
|
|
|
console.log(err);
|
|
|
|
process.exit(1);
|
2018-05-07 08:51:45 +00:00
|
|
|
}
|
|
|
|
);
|
2017-05-18 20:40:09 +00:00
|
|
|
|
2017-08-27 13:24:17 +00:00
|
|
|
// node
|
2018-05-07 08:51:45 +00:00
|
|
|
npmciSmartcli.addCommand('node').subscribe(
|
|
|
|
async argvArg => {
|
2018-11-24 14:00:19 +00:00
|
|
|
const modNode = await import('./mod_node/index');
|
2018-04-04 20:25:13 +00:00
|
|
|
await modNode.handleCli(argvArg);
|
2018-05-07 08:51:45 +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-05-07 08:51:45 +00:00
|
|
|
}
|
|
|
|
);
|
2017-05-18 20:40:09 +00:00
|
|
|
|
2017-08-27 13:24:17 +00:00
|
|
|
// npm
|
2018-05-07 08:51:45 +00:00
|
|
|
npmciSmartcli.addCommand('npm').subscribe(
|
|
|
|
async argvArg => {
|
2018-11-24 14:00:19 +00:00
|
|
|
const modNpm = await import('./mod_npm/index');
|
2018-04-04 20:25:13 +00:00
|
|
|
await modNpm.handleCli(argvArg);
|
2018-05-07 08:51:45 +00:00
|
|
|
},
|
|
|
|
err => {
|
2018-04-04 20:25:13 +00:00
|
|
|
console.log(err);
|
2018-05-07 08:51:45 +00:00
|
|
|
}
|
|
|
|
);
|
2017-05-18 20:40:09 +00:00
|
|
|
|
2017-08-27 13:24:17 +00:00
|
|
|
// trigger
|
2018-05-07 08:51:45 +00:00
|
|
|
npmciSmartcli.addCommand('ssh').subscribe(
|
|
|
|
async argvArg => {
|
2018-11-24 14:00:19 +00:00
|
|
|
const modSsh = await import('./mod_ssh/index');
|
2018-04-04 20:25:13 +00:00
|
|
|
await modSsh.handleCli(argvArg);
|
2018-05-07 08:51:45 +00:00
|
|
|
},
|
|
|
|
err => {
|
2018-04-04 20:25:13 +00:00
|
|
|
console.log(err);
|
|
|
|
process.exit(1);
|
2018-05-07 08:51:45 +00:00
|
|
|
}
|
|
|
|
);
|
2017-05-18 20:40:09 +00:00
|
|
|
|
|
|
|
// trigger
|
2018-05-07 08:51:45 +00:00
|
|
|
npmciSmartcli.addCommand('trigger').subscribe(
|
|
|
|
async argv => {
|
2018-11-24 14:00:19 +00:00
|
|
|
const modTrigger = await import('./mod_trigger/index');
|
2018-04-04 20:25:13 +00:00
|
|
|
await modTrigger.trigger();
|
2018-05-07 08:51:45 +00:00
|
|
|
},
|
|
|
|
err => {
|
2018-04-04 20:25:13 +00:00
|
|
|
console.log(err);
|
|
|
|
process.exit(1);
|
2018-05-07 08:51:45 +00:00
|
|
|
}
|
|
|
|
);
|
2017-05-18 20:40:09 +00:00
|
|
|
|
2018-05-04 13:58:11 +00:00
|
|
|
npmciSmartcli.startParse();
|