2016-05-30 00:29:30 +00:00
|
|
|
"use strict";
|
|
|
|
require("typings-global");
|
2016-07-18 14:56:53 +00:00
|
|
|
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");
|
2016-09-04 11:42:22 +00:00
|
|
|
/**
|
|
|
|
* the main exported publish function.
|
2016-09-04 14:05:47 +00:00
|
|
|
* @param pubServiceArg references targeted service to publish to
|
2016-09-04 11:42:22 +00:00
|
|
|
*/
|
2016-09-04 14:05:47 +00:00
|
|
|
exports.publish = (pubServiceArg = "npm") => {
|
|
|
|
switch (pubServiceArg) {
|
2016-06-01 03:44:48 +00:00
|
|
|
case "npm":
|
2016-06-03 14:27:12 +00:00
|
|
|
return publishNpm();
|
2016-06-01 03:44:48 +00:00
|
|
|
case "docker":
|
2016-06-03 14:27:12 +00:00
|
|
|
return publishDocker();
|
2016-05-30 03:13:15 +00:00
|
|
|
}
|
2016-06-01 03:44:48 +00:00
|
|
|
};
|
2016-09-04 11:42:22 +00:00
|
|
|
/**
|
2016-09-04 14:05:47 +00:00
|
|
|
* tries to publish current cwd to NPM registry
|
2016-09-04 11:42:22 +00:00
|
|
|
*/
|
2016-07-18 14:56:53 +00:00
|
|
|
let publishNpm = function () {
|
|
|
|
let done = plugins.q.defer();
|
2016-06-01 03:44:48 +00:00
|
|
|
npmci_prepare_1.prepare("npm")
|
|
|
|
.then(function () {
|
|
|
|
npmci_bash_1.bash("npm publish");
|
|
|
|
plugins.beautylog.ok("Done!");
|
|
|
|
done.resolve();
|
|
|
|
});
|
|
|
|
return done.promise;
|
|
|
|
};
|
2016-09-04 11:42:22 +00:00
|
|
|
/**
|
|
|
|
* tries to pubish current cwd to Docker registry
|
|
|
|
*/
|
2016-07-18 14:56:53 +00:00
|
|
|
let publishDocker = function () {
|
|
|
|
let done = plugins.q.defer();
|
2016-06-07 02:31:25 +00:00
|
|
|
NpmciBuildDocker.readDockerfiles()
|
|
|
|
.then(NpmciBuildDocker.pullDockerfileImages)
|
2016-06-07 21:21:56 +00:00
|
|
|
.then(NpmciBuildDocker.pushDockerfiles)
|
2016-06-07 02:31:25 +00:00
|
|
|
.then(done.resolve);
|
2016-05-30 00:29:30 +00:00
|
|
|
return done.promise;
|
|
|
|
};
|
2016-11-14 23:07:55 +00:00
|
|
|
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibnBtY2kucHVibGlzaC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3RzL25wbWNpLnB1Ymxpc2gudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLDBCQUF3QjtBQUN4QiwyQ0FBMkM7QUFDM0MsbURBQXdDO0FBQ3hDLDZDQUFrQztBQUVsQyx5REFBd0Q7QUFPeEQ7OztHQUdHO0FBQ1EsUUFBQSxPQUFPLEdBQUcsQ0FBQyxnQkFBNEIsS0FBSztJQUNuRCxNQUFNLENBQUMsQ0FBQyxhQUFhLENBQUMsQ0FBQSxDQUFDO1FBQ25CLEtBQUssS0FBSztZQUNOLE1BQU0sQ0FBQyxVQUFVLEVBQUUsQ0FBQztRQUN4QixLQUFLLFFBQVE7WUFDVCxNQUFNLENBQUMsYUFBYSxFQUFFLENBQUM7SUFDL0IsQ0FBQztBQUNMLENBQUMsQ0FBQztBQUVGOztHQUVHO0FBQ0gsSUFBSSxVQUFVLEdBQUk7SUFDZCxJQUFJLElBQUksR0FBRyxPQUFPLENBQUMsQ0FBQyxDQUFDLEtBQUssRUFBRSxDQUFDO0lBQzdCLHVCQUFPLENBQUMsS0FBSyxDQUFDO1NBQ1QsSUFBSSxDQUFDO1FBQ0YsaUJBQUksQ0FBQyxhQUFhLENBQUMsQ0FBQztRQUNwQixPQUFPLENBQUMsU0FBUyxDQUFDLEVBQUUsQ0FBQyxPQUFPLENBQUMsQ0FBRTtRQU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