npmci/dist/npmci.publish.js
2016-06-09 03:42:12 +02:00

36 lines
3.8 KiB
JavaScript

"use strict";
require("typings-global");
var plugins = require("./npmci.plugins");
var npmci_prepare_1 = require("./npmci.prepare");
var npmci_bash_1 = require("./npmci.bash");
var NpmciBuildDocker = require("./npmci.build.docker");
exports.publish = function (serviceArg) {
if (serviceArg === void 0) { serviceArg = "npm"; }
switch (serviceArg) {
case "npm":
return publishNpm();
case "docker":
return publishDocker();
}
};
var publishNpm = function () {
var done = plugins.q.defer();
npmci_prepare_1.prepare("npm")
.then(function () {
npmci_bash_1.bash("npm publish");
plugins.beautylog.ok("Done!");
done.resolve();
});
return done.promise;
};
var publishDocker = function () {
var done = plugins.q.defer();
NpmciBuildDocker.readDockerfiles()
.then(NpmciBuildDocker.pullDockerfileImages)
.then(NpmciBuildDocker.pushDockerfiles)
.then(done.resolve);
return done.promise;
};
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIm5wbWNpLnB1Ymxpc2gudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLFFBQU8sZ0JBQWdCLENBQUMsQ0FBQTtBQUN4QixJQUFZLE9BQU8sV0FBTSxpQkFBaUIsQ0FBQyxDQUFBO0FBQzNDLDhCQUFzQixpQkFBaUIsQ0FBQyxDQUFBO0FBQ3hDLDJCQUFtQixjQUFjLENBQUMsQ0FBQTtBQUVsQyxJQUFZLGdCQUFnQixXQUFNLHNCQUVsQyxDQUFDLENBRnVEO0FBRTdDLGVBQU8sR0FBRyxVQUFDLFVBQXlCO0lBQXpCLDBCQUF5QixHQUF6QixrQkFBeUI7SUFDM0MsTUFBTSxDQUFDLENBQUMsVUFBVSxDQUFDLENBQUEsQ0FBQztRQUNoQixLQUFLLEtBQUs7WUFDTixNQUFNLENBQUMsVUFBVSxFQUFFLENBQUM7UUFDeEIsS0FBSyxRQUFRO1lBQ1QsTUFBTSxDQUFDLGFBQWEsRUFBRSxD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