2016-05-30 00:29:30 +00:00
|
|
|
"use strict";
|
|
|
|
require("typings-global");
|
|
|
|
var plugins = require("./npmci.plugins");
|
2016-05-30 01:40:07 +00:00
|
|
|
var npmci_bash_1 = require("./npmci.bash");
|
2016-05-30 00:29:30 +00:00
|
|
|
exports.install = function (versionArg) {
|
|
|
|
var done = plugins.q.defer();
|
2016-06-01 03:44:48 +00:00
|
|
|
plugins.beautylog.log("now installing " + "node ".green + ("version " + versionArg).yellow);
|
2016-05-30 00:29:30 +00:00
|
|
|
var version;
|
2016-05-30 04:07:07 +00:00
|
|
|
if (versionArg == "lts") {
|
2016-05-30 00:29:30 +00:00
|
|
|
version = "4";
|
|
|
|
}
|
2016-06-01 04:04:20 +00:00
|
|
|
else if (versionArg == "legacy") {
|
2016-06-01 03:44:48 +00:00
|
|
|
version = "4.0.0";
|
|
|
|
}
|
2016-05-30 00:29:30 +00:00
|
|
|
else {
|
|
|
|
version = versionArg;
|
|
|
|
}
|
|
|
|
;
|
2016-05-30 01:40:07 +00:00
|
|
|
npmci_bash_1.bash("nvm install " + version +
|
2016-05-30 02:13:01 +00:00
|
|
|
" && nvm alias default " + version);
|
2016-05-30 00:29:30 +00:00
|
|
|
plugins.beautylog.success("Node version " + version + " successfully installed!");
|
2016-05-30 01:54:14 +00:00
|
|
|
npmci_bash_1.bash("node -v");
|
|
|
|
npmci_bash_1.bash("npm -v");
|
2016-05-30 00:29:30 +00:00
|
|
|
done.resolve();
|
|
|
|
return done.promise;
|
|
|
|
};
|
|
|
|
|
2016-06-04 21:20:39 +00:00
|
|
|
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIm5wbWNpLmluc3RhbGwudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLFFBQU8sZ0JBQWdCLENBQUMsQ0FBQTtBQUN4QixJQUFZLE9BQU8sV0FBTSxpQkFBaUIsQ0FBQyxDQUFBO0FBQzNDLDJCQUFtQ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