npmci/dist/npmci.install.js
2016-06-09 03:42:12 +02:00

29 lines
3.1 KiB
JavaScript

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