switched from commander to smartcli
This commit is contained in:
parent
9f5c7b0ca0
commit
3ebed47170
105
dist/index.js
vendored
105
dist/index.js
vendored
File diff suppressed because one or more lines are too long
2
dist/npmci.plugins.d.ts
vendored
2
dist/npmci.plugins.d.ts
vendored
@ -1,6 +1,5 @@
|
||||
import "typings-global";
|
||||
export import beautylog = require("beautylog");
|
||||
export declare let commander: any;
|
||||
export declare let gulp: any;
|
||||
export declare let gulpFunction: any;
|
||||
export import path = require("path");
|
||||
@ -8,6 +7,7 @@ export import projectinfo = require("projectinfo");
|
||||
export declare let q: any;
|
||||
export declare let request: any;
|
||||
export declare let shelljs: any;
|
||||
export import smartcli = require("smartcli");
|
||||
export import smartfile = require("smartfile");
|
||||
export import smartparam = require("smartparam");
|
||||
export import smartssh = require("smartssh");
|
||||
|
4
dist/npmci.plugins.js
vendored
4
dist/npmci.plugins.js
vendored
@ -1,7 +1,6 @@
|
||||
"use strict";
|
||||
require("typings-global");
|
||||
exports.beautylog = require("beautylog");
|
||||
exports.commander = require("commander");
|
||||
exports.gulp = require("gulp");
|
||||
exports.gulpFunction = require("gulp-function");
|
||||
exports.path = require("path");
|
||||
@ -9,10 +8,11 @@ exports.projectinfo = require("projectinfo");
|
||||
exports.q = require("q");
|
||||
exports.request = require("request");
|
||||
exports.shelljs = require("shelljs");
|
||||
exports.smartcli = require("smartcli");
|
||||
exports.smartfile = require("smartfile");
|
||||
exports.smartparam = require("smartparam");
|
||||
exports.smartssh = require("smartssh");
|
||||
exports.smartstring = require("smartstring");
|
||||
exports.through2 = require("through2");
|
||||
|
||||
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIm5wbWNpLnBsdWdpbnMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLFFBQU8sZ0JBQWdCLENBQUMsQ0FBQTtBQUNWLGlCQUFTLFdBQVcsV0FBVyxDQUFDLENBQUM7QUFDcEMsaUJBQVMsR0FBRyxP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WlyZShcInNtYXJ0cGFyYW1cIik7XG5leHBvcnQgaW1wb3J0IHNtYXJ0c3NoID0gcmVxdWlyZShcInNtYXJ0c3NoXCIpO1xuZXhwb3J0IGltcG9ydCBzbWFydHN0cmluZyA9IHJlcXVpcmUoXCJzbWFydHN0cmluZ1wiKTtcbmV4cG9ydCBsZXQgdGhyb3VnaDIgPSByZXF1aXJlKFwidGhyb3VnaDJcIik7Il19
|
||||
|
@ -27,13 +27,13 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"beautylog": "^5.0.12",
|
||||
"commander": "^2.9.0",
|
||||
"gulp": "^3.9.1",
|
||||
"gulp-function": "^1.3.6",
|
||||
"projectinfo": "^1.0.3",
|
||||
"q": "^1.4.1",
|
||||
"request": "^2.72.0",
|
||||
"shelljs": "^0.7.0",
|
||||
"smartcli": "^1.0.4",
|
||||
"smartfile": "^4.0.5",
|
||||
"smartparam": "^0.1.1",
|
||||
"smartssh": "^1.1.0",
|
||||
|
109
ts/index.ts
109
ts/index.ts
@ -6,7 +6,7 @@ let npmciInfo = new plugins.projectinfo.ProjectinfoNpm(paths.NpmciPackageRoot);
|
||||
plugins.beautylog.log("npmci version: " + npmciInfo.version);
|
||||
|
||||
import {build} from "./npmci.build"
|
||||
import {command as command2} from "./npmci.command";
|
||||
import {command} from "./npmci.command";
|
||||
import {install} from "./npmci.install";
|
||||
import {publish} from "./npmci.publish";
|
||||
import {prepare} from "./npmci.prepare";
|
||||
@ -19,60 +19,63 @@ export {build} from "./npmci.build"
|
||||
export {install} from "./npmci.install";
|
||||
export {publish} from "./npmci.publish";
|
||||
|
||||
let command;
|
||||
let commandOption:string;
|
||||
|
||||
let commander = plugins.commander
|
||||
.option("-v","--version","print version")
|
||||
.arguments('<commandarg> [commandoptionarg]')
|
||||
.action(function (commandarg, commandoptionarg) {
|
||||
command = commandarg;
|
||||
commandOption = commandoptionarg;
|
||||
});
|
||||
|
||||
plugins.commander.parse(process.argv);
|
||||
let smartcli = new plugins.smartcli.Smartcli();
|
||||
smartcli.addVersion(npmciInfo.version);
|
||||
|
||||
if(commander.version) {
|
||||
console.log(npmciInfo.version);
|
||||
process.exit(0);
|
||||
}
|
||||
// build
|
||||
smartcli.addCommand({
|
||||
commandName:"build"
|
||||
}).then((argv) => {
|
||||
build(argv._[1])
|
||||
.then(NpmciEnv.configStore);
|
||||
});
|
||||
|
||||
if (typeof command === 'undefined') {
|
||||
console.error('no command given!');
|
||||
process.exit(1);
|
||||
}
|
||||
// command
|
||||
smartcli.addCommand({
|
||||
commandName:"command"
|
||||
}).then((argv) => {
|
||||
command()
|
||||
.then(NpmciEnv.configStore);
|
||||
});
|
||||
|
||||
switch (command){
|
||||
case "build":
|
||||
build(commandOption)
|
||||
.then(NpmciEnv.configStore);
|
||||
break;
|
||||
case "command":
|
||||
command2()
|
||||
.then(NpmciEnv.configStore);
|
||||
break;
|
||||
case "install":
|
||||
install(commandOption)
|
||||
.then(NpmciEnv.configStore);;
|
||||
break;
|
||||
case "prepare":
|
||||
prepare(commandOption)
|
||||
.then(NpmciEnv.configStore);;
|
||||
break;
|
||||
case "publish":
|
||||
publish(commandOption)
|
||||
.then(NpmciEnv.configStore);;
|
||||
break;
|
||||
case "test":
|
||||
test(commandOption)
|
||||
.then(NpmciEnv.configStore);
|
||||
break;
|
||||
case "trigger":
|
||||
trigger();
|
||||
break;
|
||||
default:
|
||||
plugins.beautylog.error("command " + commandOption.blue + " not recognised");
|
||||
process.exit(1);
|
||||
break;
|
||||
}
|
||||
// install
|
||||
smartcli.addCommand({
|
||||
commandName:"install"
|
||||
}).then((argv) => {
|
||||
install(argv._[1])
|
||||
.then(NpmciEnv.configStore);
|
||||
});
|
||||
|
||||
// prepare
|
||||
smartcli.addCommand({
|
||||
commandName:"prepare"
|
||||
}).then((argv) => {
|
||||
prepare(argv._[1])
|
||||
.then(NpmciEnv.configStore);
|
||||
});
|
||||
|
||||
// publish
|
||||
smartcli.addCommand({
|
||||
commandName:"publish"
|
||||
}).then((argv) => {
|
||||
publish(argv._[1])
|
||||
.then(NpmciEnv.configStore);
|
||||
});
|
||||
|
||||
// test
|
||||
smartcli.addCommand({
|
||||
commandName:"test"
|
||||
}).then((argv) => {
|
||||
test(argv._[1])
|
||||
.then(NpmciEnv.configStore);
|
||||
});
|
||||
|
||||
// trigger
|
||||
smartcli.addCommand({
|
||||
commandName:"trigger"
|
||||
}).then((argv) => {
|
||||
trigger();
|
||||
});
|
||||
|
||||
smartcli.startParse();
|
@ -1,6 +1,5 @@
|
||||
import "typings-global";
|
||||
export import beautylog = require("beautylog");
|
||||
export let commander = require("commander");
|
||||
export let gulp = require("gulp");
|
||||
export let gulpFunction = require("gulp-function");
|
||||
export import path = require("path");
|
||||
@ -8,6 +7,7 @@ export import projectinfo = require("projectinfo");
|
||||
export let q = require("q");
|
||||
export let request = require("request");
|
||||
export let shelljs = require("shelljs");
|
||||
export import smartcli = require("smartcli");
|
||||
export import smartfile = require("smartfile");
|
||||
export import smartparam = require("smartparam");
|
||||
export import smartssh = require("smartssh");
|
||||
|
Loading…
Reference in New Issue
Block a user