npmci/dist/index.js
2016-06-11 20:22:00 +02:00

72 lines
7.5 KiB
JavaScript

#!/usr/bin/env node
"use strict";
require("typings-global");
var plugins = require("./npmci.plugins");
var paths = require("./npmci.paths");
var npmciInfo = new plugins.projectinfo.ProjectinfoNpm(paths.NpmciPackageRoot);
plugins.beautylog.log("npmci version: " + npmciInfo.version);
var npmci_build_1 = require("./npmci.build");
var npmci_install_1 = require("./npmci.install");
var npmci_publish_1 = require("./npmci.publish");
var npmci_prepare_1 = require("./npmci.prepare");
var npmci_test_1 = require("./npmci.test");
var npmci_trigger_1 = require("./npmci.trigger");
var NpmciEnv = require("./npmci.env");
var npmci_build_2 = require("./npmci.build");
exports.build = npmci_build_2.build;
var npmci_install_2 = require("./npmci.install");
exports.install = npmci_install_2.install;
var npmci_publish_2 = require("./npmci.publish");
exports.publish = npmci_publish_2.publish;
var command;
var commandOption;
plugins.commander
.arguments('<commandarg> [commandoptionarg]')
.action(function (commandarg, commandoptionarg) {
command = commandarg;
commandOption = commandoptionarg;
});
plugins.commander.parse(process.argv);
if (typeof command === 'undefined') {
console.error('no command given!');
process.exit(1);
}
switch (command) {
case "build":
npmci_build_1.build(commandOption)
.then(NpmciEnv.configStore);
break;
case "command":
command()
.then(NpmciEnv.configStore);
break;
case "install":
npmci_install_1.install(commandOption)
.then(NpmciEnv.configStore);
;
break;
case "prepare":
npmci_prepare_1.prepare(commandOption)
.then(NpmciEnv.configStore);
;
break;
case "publish":
npmci_publish_1.publish(commandOption)
.then(NpmciEnv.configStore);
;
break;
case "test":
npmci_test_1.test(commandOption)
.then(NpmciEnv.configStore);
break;
case "trigger":
npmci_trigger_1.trigger();
break;
default:
plugins.beautylog.error("command " + commandOption.blue + " not recognised");
process.exit(1);
break;
}
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImluZGV4LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7O0FBQ0EsUUFBTyxnQkFBZ0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jaUVudi5jb25maWdTdG9yZSk7XG4gICAgICAgIGJyZWFrO1xuICAgIGNhc2UgXCJjb21tYW5kXCI6XG4gICAgICAgIGNvbW1hbmQoKVxuICAgICAgICAgICAgLnRoZW4oTnBtY2lFbnYuY29uZmlnU3RvcmUpO1xuICAgICAgICBicmVhaztcbiAgICBjYXNlIFwiaW5zdGFsbFwiOlxuICAgICAgICBpbnN0YWxsKGNvbW1hbmRPcHRpb24pXG4gICAgICAgICAgICAudGhlbihOcG1jaUVudi5jb25maWdTdG9yZSk7O1xuICAgICAgICBicmVhaztcbiAgICBjYXNlIFwicHJlcGFyZVwiOlxuICAgICAgICBwcmVwYXJlKGNvbW1hbmRPcHRpb24pXG4gICAgICAgICAgICAudGhlbihOcG1jaUVudi5jb25maWdTdG9yZSk7O1xuICAgICAgICBicmVhaztcbiAgICBjYXNlIFwicHVibGlzaFwiOlxuICAgICAgICBwdWJsaXNoKGNvbW1hbmRPcHRpb24pXG4gICAgICAgICAgICAudGhlbihOcG1jaUVudi5jb25maWdTdG9yZSk7O1xuICAgICAgICBicmVhaztcbiAgICBjYXNlIFwidGVzdFwiOlxuICAgICAgICB0ZXN0KGNvbW1hbmRPcHRpb24pXG4gICAgICAgICAgICAudGhlbihOcG1jaUVudi5jb25maWdTdG9yZSk7XG4gICAgICAgIGJyZWFrO1xuICAgIGNhc2UgXCJ0cmlnZ2VyXCI6XG4gICAgICAgIHRyaWdnZXIoKTtcbiAgICAgICAgYnJlYWs7XG4gICAgZGVmYXVsdDpcbiAgICAgICAgcGx1Z2lucy5iZWF1dHlsb2cuZXJyb3IoXCJjb21tYW5kIFwiICsgY29tbWFuZE9wdGlvbi5ibHVlICsgXCIgbm90IHJlY29nbmlzZWRcIik7XG4gICAgICAgIHByb2Nlc3MuZXhpdCgxKTtcbiAgICAgICAgYnJlYWs7XG59XG5cbiJdfQ==