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");
|
2016-09-04 11:42:22 +00:00
|
|
|
/**
|
|
|
|
* the main exported publish function.
|
2016-09-04 14:05:47 +00:00
|
|
|
* @param pubServiceArg references targeted service to publish to
|
2016-09-04 11:42:22 +00:00
|
|
|
*/
|
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 11:42:22 +00:00
|
|
|
/**
|
2016-09-04 14:05:47 +00:00
|
|
|
* tries to publish current cwd to NPM registry
|
2016-09-04 11:42:22 +00:00
|
|
|
*/
|
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
|
|
|
});
|
2016-09-04 11:42:22 +00:00
|
|
|
/**
|
|
|
|
* tries to pubish 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)
|
2016-06-07 21:21:56 +00:00
|
|
|
.then(NpmciBuildDocker.pushDockerfiles)
|
2017-03-11 00:10:37 +00:00
|
|
|
.then(dockerfileArray => {
|
|
|
|
return dockerfileArray;
|
|
|
|
});
|
|
|
|
});
|
|
|
|
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibnBtY2kucHVibGlzaC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3RzL25wbWNpLnB1Ymxpc2gudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7Ozs7OztBQUFBLDJDQUEwQztBQUMxQyxtREFBeUM7QUFDekMsNkNBQW1DO0FBRW5DLHlEQUF3RDtBQU94RDs7O0dBR0c7QUFDUSxRQUFBLE9BQU8sR0FBRyxDQUFPLGdCQUE2QixLQUFLO0lBQzVELE1BQU0sQ0FBQyxDQUFDLGFBQWEsQ0FBQyxDQUFDLENBQUM7UUFDdEIsS0FBSyxLQUFLO1lBQ1IsTU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