48 lines
3.3 KiB
JavaScript
48 lines
3.3 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 'npm':
|
|
return yield publishNpm(argvArg);
|
|
case 'docker':
|
|
return yield publishDocker(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 dockerfileArray;
|
|
});
|
|
});
|
|
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJm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