npmci/dist/mod_publish/index.js

48 lines
3.3 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 });
2017-05-19 10:09:33 +00:00
const plugins = require("./mod.plugins");
const npmci_bash_1 = require("../npmci.bash");
const npmciMods = require("../npmci.mods");
/**
* the main exported publish function.
2016-09-04 14:05:47 +00:00
* @param pubServiceArg references targeted service to publish to
*/
exports.publish = (argvArg) => __awaiter(this, void 0, void 0, function* () {
let whatToPublish = argvArg._[1];
switch (whatToPublish) {
2016-11-24 22:21:40 +00:00
case 'npm':
return yield publishNpm(argvArg);
2016-11-24 22:21:40 +00:00
case 'docker':
return yield publishDocker(argvArg);
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
*/
let publishNpm = (argvArg) => __awaiter(this, void 0, void 0, function* () {
2017-05-19 10:09:33 +00:00
let modPrepare = yield npmciMods.modPrepare.load();
yield modPrepare.prepare('npm');
yield npmci_bash_1.bash('npm publish');
plugins.beautylog.ok('Done!');
2017-03-11 00:10:37 +00:00
});
/**
2017-05-18 20:40:09 +00:00
* tries to publish current cwd to Docker registry
*/
let publishDocker = (argvArg) => __awaiter(this, void 0, void 0, function* () {
2017-05-19 10:09:33 +00:00
let modDocker = yield npmciMods.modDocker.load();
return yield modDocker.readDockerfiles(argvArg)
2017-05-19 10:09:33 +00:00
.then(modDocker.pullDockerfileImages)
.then(modDocker.pushDockerfi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