npmci/dist/mod_publish/index.js

51 lines
3.6 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 'docker':
return yield publishDocker(argvArg);
2017-07-27 19:51:38 +00:00
case 'npm':
return yield publishNpm(argvArg);
default:
plugins.beautylog.info('no publish target sepcified, defaulting to npm...');
return yield publishNpm(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.pushDockerfiles)
2017-03-11 00:10:37 +00:00
.then(dockerfileArray => {
return dockerfileArray;
});
});
2017-07-27 19:51:38 +00:00
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi90cy9tb2RfcHVibGlzaC9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7Ozs7Ozs7O0FBQUEseUNBQXdDO0FBQ3hDLDhDQUFvQztBQUdwQywyQ0FBMEM7QUFXMUM7OztHQUdHO0FBQ1EsUUFBQSxPQUFPLEdBQUcsQ0FBTyxPQUFZO0lBQ3RDLElBQUksYUFBYSxHQUFHLE9BQU8sQ0FBQyxDQUFDLENBQUMsQ0FBQyxDQUFDLENBQUE7SUFDaEMsTUFBTSxDQUFDLENBQUMsYUFBYSxDQUFDLENBQUMsQ0FBQztRQUN0QixLQUFLLFFBQVE7WUFDWCxNQUFNLENBQUMsTUFBTSxhQUFhLENBQUMsT0FBTyxDQUFDLENBQUE7UUFDckMsS0FBSyxLQUFLO1lBQ1IsTUFBTSxDQUFDLE1BQU0sVUFBVSxDQUFDLE9BQU8sQ0FBQyxDQUFBO1FBQ2xDO1lBQ0UsT0FBTyxDQUFDLFNBQVMsQ0FBQyxJQUFJLENBQUMsbURBQW1ELENBQUMsQ0FBQTtZQUMzRSxNQUFNLENBQUMsTUFBTSxVQUFVLENBQUMsT0FBTyxDQUFDLENBQUE7SUFDcEMsQ0FBQztBQUNILENBQUMsQ0FBQSxDQUFBO0FBRUQ7O0dBRUc7QUFDSCxJQUFJLFVBQVUsR0FBRyxDQUFPLE9BQU87SUFDN0IsSUFBSSxVQUFVLEdBQUcsTUFBTSxTQUFTLENBQUMsVUFBVSxDQUFDLElBQUksRUFBRSxDQUFBO0lBQ2xELE1BQU0sVUFBVSxDQUFDLE9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