npmci/dist/npmci.publish.js
2016-11-25 00:07:20 +01:00

42 lines
2.5 KiB
JavaScript

"use strict";
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,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibnBtY2kucHVibGlzaC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3RzL25wbWNpLnB1Ymxpc2gudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLDJDQUEwQztBQUMxQyxtREFBdUM7QUFDdkMsNkNBQWlDO0FBRWpDLHlEQUF3RDtBQU94RDs7O0dBR0c7QUFDUSxRQUFBLE9BQU8sR0FBRyxDQUFDLGdCQUE2QixLQUFLO0lBQ3BELE1BQU0sQ0FBQyxDQUFDLGFBQWEsQ0FBQyxDQUFDLENBQUM7UUFDcEIsS0FBSyxLQUFLO1lBQ04sTUFBTSxDQUFDLFVBQVUsRUFBRSxDQUFBO1FBQ3ZCLEtBQUssUUFBUTtZQUNULE1BQU0sQ0FBQyxhQUFhLEVBQUUsQ0FBQTtJQUM5QixDQUFDO0FBQ0wsQ0FBQyxD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