npmci/dist/npmci.prepare.js
2016-06-01 05:44:48 +02:00

32 lines
3.5 KiB
JavaScript

"use strict";
require("typings-global");
var plugins = require("./npmci.plugins");
var docker = function () {
};
var npm = function () {
var done = plugins.q.defer();
var npmrcPrefix = "//registry.npmjs.org/:_authToken=";
var npmToken = process.env.NPMCITOKEN;
var npmrcFileString = npmrcPrefix + npmToken;
if (npmToken) {
plugins.beautylog.info("found access token");
}
else {
plugins.beautylog.error("no access token found! Exiting!");
process.exit(1);
}
plugins.smartfile.memory.toFsSync(npmrcFileString, { fileName: ".npmrc", filePath: "/root" });
done.resolve();
return done.promise;
};
exports.prepare = function (serviceArg) {
switch (serviceArg) {
case "npm":
return npm();
case "docker":
return docker();
}
};
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIm5wbWNpLnByZXBhcmUudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLFFBQU8sZ0JBQWdCLENBQUMsQ0FBQTtBQUN4QixJQUFZLE9BQU8sV0FBTSxpQkFBaUIsQ0FBQyxDQUFBO0FBRTNDLElBQUksTUFBTSxHQUFHO0FBRWIsQ0FBQyxDQUFBO0FBRUQsSUFBSSxHQUFHLEdBQUc7SUFDTixJQUFJLElBQUksR0FBRyxPQUFPLENBQUMsQ0FBQyxDQUFDLEtBQUssRUFBRSxDQUFDO0lBRTdCLElBQUksV0FBVyxHQUFVLG1DQUFtQyxDQUFDO0lBQzdELElBQUksUUFBUSxHQUFVLE9BQU8sQ0FBQyxHQUFHLENBQUMsVUFBVSxDQUFDO0lBQzdDLElBQUksZUFBZSxHQUFHLFdBQVcsR0FBRyxRQUFRLENBQUM7SUFFN0MsRUFBRSxDQUFBLENBQUMsUUFBUSxDQUFDLENBQUEsQ0FBQztRQUNULE9BQU8sQ0FBQyxTQUFTLENBQUMsSUFBSSxDQUFDLG9CQUFvQixDQUFDLENBQUM7SUFDakQsQ0FBQztJQUFDLElBQUksQ0F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