npmci/dist/npmci.install.js
2016-05-30 03:11:13 +02:00

28 lines
3.1 KiB
JavaScript

"use strict";
require("typings-global");
var plugins = require("./npmci.plugins");
exports.install = function (versionArg) {
var done = plugins.q.defer();
var version;
if (versionArg = "lts") {
version = "4";
}
else {
version = versionArg;
}
;
plugins.beautylog.log("now installing " + "node ".green + ("version " + version).yellow);
plugins.shelljs.exec("bash -c \"source /usr/local/nvm/nvm.sh && nvm install " +
version +
" nvm alias default " +
version +
"\"");
plugins.beautylog.success("Node version " + version + " successfully installed!");
plugins.shelljs.exec("node -v");
plugins.shelljs.exec("npm -v");
done.resolve();
return done.promise;
};
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIm5wbWNpLmluc3RhbGwudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLFFBQU8sZ0JBQWdCLENBQUMsQ0FBQTtBQUN4QixJQUFZLE9BQU8sV0FBTSxpQkFBaUIsQ0FBQyxDQUFBO0FBQ2hDLGVBQU8sR0FBRyxVQUFDLFVBQVU7SUFDNUIsSUFBSSxJQUFJLEdBQUcsT0FBTyxDQUFDLENBQUMsQ0FBQyxLQUFLLEVBQUUsQ0FBQztJQUM3QixJQUFJLE9BQWMsQ0FBQztJQUNuQixFQUFFLENBQUEsQ0FBQyxVQUFVLEdBQUcsS0FBSyxDQUFDLENBQUEsQ0FBQztRQUNuQixPQUFPLEdBQUcsR0FBRyxDQUFDO0lBQ2xCLENBQUM7SUFBQyxJQUFJLENBQUMsQ0FBQztRQUNKLE9BQU8sR0FBRyxVQUFVLENBQUM7SUFDekIsQ0FBQztJQUFBLENBQUM7SUFDRixPQUFPLENBQUMsU0FBUyxDQUFDLEdBQUcsQ0FBQyxpQkFBaUIsR0FBRyxPQUFPLENBQUMsS0FBSyxHQUFHLENBQUMsVUFBVSxHQUFHLE9BQU8sQ0FBQyxDQUFDLE1BQU0sQ0FBQyxDQUFDO0lBQ3pGLE9B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