npmci/dist/npmci.publish.js

42 lines
2.5 KiB
JavaScript
Raw Normal View History

2016-05-30 00:29:30 +00:00
"use strict";
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-11-24 22:21:40 +00:00
exports.publish = (pubServiceArg = 'npm') => {
2016-09-04 14:05:47 +00:00
switch (pubServiceArg) {
2016-11-24 22:21:40 +00:00
case 'npm':
2016-06-03 14:27:12 +00:00
return publishNpm();
2016-11-24 22:21:40 +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-11-24 22:21:40 +00:00
npmci_prepare_1.prepare('npm')
2016-06-01 03:44:48 +00:00
.then(function () {
2016-11-24 22:21:40 +00:00
npmci_bash_1.bash('npm publish');
plugins.beautylog.ok('Done!');
2016-06-01 03:44:48 +00:00
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-11-24 23:07:20 +00:00
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibnBtY2kucHVibGlzaC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3RzL25wbWNpLnB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