npmci/dist/mod_publish/index.js

50 lines
3.1 KiB
JavaScript
Raw Normal View History

2016-05-30 00:29:30 +00:00
"use strict";
2017-03-11 00:10:37 +00:00
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
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
*/
2017-03-11 00:10:37 +00:00
exports.publish = (pubServiceArg = 'npm') => __awaiter(this, void 0, void 0, function* () {
2016-09-04 14:05:47 +00:00
switch (pubServiceArg) {
2016-11-24 22:21:40 +00:00
case 'npm':
2017-03-11 00:10:37 +00:00
return yield publishNpm();
2016-11-24 22:21:40 +00:00
case 'docker':
2017-03-11 00:10:37 +00:00
return yield publishDocker();
2016-05-30 03:13:15 +00:00
}
2017-03-11 00:10:37 +00:00
});
/**
2016-09-04 14:05:47 +00:00
* tries to publish current cwd to NPM registry
*/
2017-03-11 00:10:37 +00:00
let publishNpm = () => __awaiter(this, void 0, void 0, function* () {
yield npmci_prepare_1.prepare('npm')
2016-06-01 03:44:48 +00:00
.then(function () {
2017-03-11 00:10:37 +00:00
return __awaiter(this, void 0, void 0, function* () {
yield npmci_bash_1.bash('npm publish');
plugins.beautylog.ok('Done!');
});
2016-06-01 03:44:48 +00:00
});
2017-03-11 00:10:37 +00:00
});
/**
2017-05-18 20:40:09 +00:00
* tries to publish current cwd to Docker registry
*/
2017-03-11 00:10:37 +00:00
let publishDocker = () => __awaiter(this, void 0, void 0, function* () {
return yield NpmciBuildDocker.readDockerfiles()
2016-06-07 02:31:25 +00:00
.then(NpmciBuildDocker.pullDockerfileImages)
.then(NpmciBuildDocker.pushDockerfiles)
2017-03-11 00:10:37 +00:00
.then(dockerfileArray => {
return dockerfileArray;
});
});
2017-05-18 20:40:09 +00:00
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi90cy9tb2RfcHVibGlzaC9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7Ozs7Ozs7O0FBQUEsMkNBQTBDO0FBQzFDLG1EQUF5QztBQUN6Qyw2Q0FBbUM7QUFFbkMseURBQXdEO0FBT3hEOzs7R0FHRztBQUNRLFFBQUEsT0FBTyxHQUFHLENBQU8sZ0JBQTZCLEtBQUs7SUFDNUQsTUFBTSxDQUFDLENBQUMsYUFBYSxDQUFDLENBQUMsQ0FBQztRQUN0QixLQUFLLEtBQUs7WUFDUixNQUFNLENBQUMsTUFBTSxVQUFVLEVBQUUsQ0FBQTtRQUMzQixLQUFLLFFBQVE7WUFDWCxNQUFNLENBQUMsTUFBTSxhQUFhLEVBQUUsQ0FBQTtJQUNoQyxDQUFDO0FBQ0gsQ0FBQyxDQUFBLENBQUE7QUFFRDs7R0FFRztBQUNILElBQUksVUFBVSxHQUFHO0lBQ2YsTUFBTSx1QkFBTyxDQUFDLEtBQUssQ0FBQztTQUNqQixJQUFJLENBQUM7O1lBQ0osTUFBTSxpQkFBSSxDQUFDLGFBQWEsQ0FBQyxDQUFBO1lBQ3pCLE9BQU8sQ0FBQyxTQUFTLENBQUMsRUFBRSxDQUFDLE9BQU8sQ0FBQyxDQUFBO1FBQy9CLENBQUM7S0FBQSxDQUFDLENBQUE7QUFDTixDQUFDLENBQUEsQ0FBQTtBQUVEOztHQU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