43 lines
2.6 KiB
JavaScript
43 lines
2.6 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 registryServiceArg the serviceArg
|
|
*/
|
|
exports.publish = (registryServiceArg = "npm") => {
|
|
switch (registryServiceArg) {
|
|
case "npm":
|
|
return publishNpm();
|
|
case "docker":
|
|
return publishDocker();
|
|
}
|
|
};
|
|
/**
|
|
* tries to publish project at cwd to npm
|
|
*/
|
|
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,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibnBtY2kucHVibGlzaC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3RzL25wbWNpLnB1Ymxpc2gudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLFFBQU8sZ0JBQWdCLENBQUMsQ0FBQTtBQUN4QixNQUFZLE9BQU8sV0FBTSxpQkFBaUIsQ0FBQyxDQUFBO0FBQzNDLGdDQUFzQixpQkFBaUIsQ0FBQyxDQUFBO0FBQ3hDLDZCQUFtQixjQUFjLENBQUMsQ0FBQTtBQUVsQyxNQUFZLGdCQUFnQix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