npmci/dist/npmci.publish.js

43 lines
2.6 KiB
JavaScript
Raw Normal View History

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");
/**
* the main exported publish function.
2016-09-04 14:05:47 +00:00
* @param pubServiceArg references targeted service to publish to
*/
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 14:05:47 +00:00
* tries to publish current cwd to NPM registry
*/
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;
};
/**
* 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)
.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-09-04 14:05:47 +00:00
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibnBtY2kucHVibGlzaC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3RzL25wbWNpLnB1Ymxpc2gudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLFFBQU8sZ0JBQWd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