npmci/dist/npmci.publish.js

43 lines
2.5 KiB
JavaScript

"use strict";
require("typings-global");
const plugins = require("./npmci.plugins");
const npmci_prepare_1 = require("./npmci.prepare");
const npmci_bash_1 = require("./npmci.bash");
const NpmciBuildDocker = require("./npmci.build.docker");
/**
* the main exported publish function.
* @param pubServiceArg references targeted service to publish to
*/
exports.publish = (pubServiceArg = "npm") => {
switch (pubServiceArg) {
case "npm":
return publishNpm();
case "docker":
return publishDocker();
}
};
/**
* tries to publish current cwd to NPM registry
*/
let publishNpm = function () {
let 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;
};
/**
* tries to pubish current cwd to Docker registry
*/
let publishDocker = function () {
let done = plugins.q.defer();
NpmciBuildDocker.readDockerfiles()
.then(NpmciBuildDocker.pullDockerfileImages)
.then(NpmciBuildDocker.pushDockerfiles)
.then(done.resolve);
return done.promise;
};
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibnBtY2kucHVibGlzaC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3RzL25wbWNpLnB1Ymxpc2gudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLDBCQUF3QjtBQUN4QiwyQ0FBMkM7QUFDM0MsbURBQXdDO0FBQ3hDLDZDQUFrQztBQUVsQyx5REFBd0Q7QUFPeEQ7OztHQUdHO0FBQ1EsUUFBQSxPQUFPLEdBQUcsQ0FBQyxnQkFBNEIsS0FBSztJQUNuRCxNQUFNLENBQUMsQ0FBQyxhQUFhLENBQUMsQ0FBQSxDQUFDO1FBQ25CLEtBQUssS0FBSztZQUNOLE1BQU0sQ0FBQyxVQUFVLEVBQUUsQ0FBQztRQUN4QixLQUFLLFFBQVE7WUFDVCxNQUFNLENBQUMsYUFBYSxFQUFFLENBQUM7SUFDL0IsQ0FBQztBQUNMLENBQUMsQ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