51 lines
3.6 KiB
JavaScript
51 lines
3.6 KiB
JavaScript
"use strict";
|
|
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 });
|
|
const plugins = require("./mod.plugins");
|
|
const npmci_bash_1 = require("../npmci.bash");
|
|
const npmciMods = require("../npmci.mods");
|
|
/**
|
|
* the main exported publish function.
|
|
* @param pubServiceArg references targeted service to publish to
|
|
*/
|
|
exports.publish = (argvArg) => __awaiter(this, void 0, void 0, function* () {
|
|
let whatToPublish = argvArg._[1];
|
|
switch (whatToPublish) {
|
|
case 'docker':
|
|
return yield publishDocker(argvArg);
|
|
case 'npm':
|
|
return yield publishNpm(argvArg);
|
|
default:
|
|
plugins.beautylog.info('no publish target specified, thus defaulting to npm...');
|
|
return yield publishNpm(argvArg);
|
|
}
|
|
});
|
|
/**
|
|
* tries to publish current cwd to NPM registry
|
|
*/
|
|
let publishNpm = (argvArg) => __awaiter(this, void 0, void 0, function* () {
|
|
let modPrepare = yield npmciMods.modPrepare.load();
|
|
yield modPrepare.prepare('npm');
|
|
yield npmci_bash_1.bash('npm publish');
|
|
plugins.beautylog.ok('Done!');
|
|
});
|
|
/**
|
|
* tries to publish current cwd to Docker registry
|
|
*/
|
|
let publishDocker = (argvArg) => __awaiter(this, void 0, void 0, function* () {
|
|
let modDocker = yield npmciMods.modDocker.load();
|
|
return yield modDocker.readDockerfiles(argvArg)
|
|
.then(modDocker.pullDockerfileImages)
|
|
.then(modDocker.pushDockerfiles)
|
|
.then(dockerfileArray => {
|
|
return dockerfileAr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