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.
* @param registryServiceArg the serviceArg
*/
exports.publish = (registryServiceArg = "npm") => {
switch (registryServiceArg) {
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
};
/**
* tries to publish project at cwd to npm
*/
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;
};
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibnBtY2kucHVibGlzaC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3RzL25wbWNpLnB1Ymxpc2gudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLFFBQU8sZ0JBQWdCLENBQUMsQ0FBQTtBQUN4QixNQUFZLE9BQU8sV0FBTSxpQkFBaUIsQ0FBQyxDQUFBO0FBQzNDLGdD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