npmci/dist/npmci.install.js

29 lines
3.1 KiB
JavaScript
Raw Normal View History

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-25 10:34:57 +00:00
version = "0";
2016-06-01 03:44:48 +00:00
}
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-25 10:34:57 +00:00
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIm5wbWNpLmluc3RhbGwudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLFFBQU8sZ0JBQWdCLENBQUMsQ0FBQTtBQUN4QixJQUFZLE9BQU8sV0FBTSxpQkFBaUIsQ0FBQyxDQUFBO0FBQzNDLDJCQUFtQixjQUFjLENBQUMsQ0FBQTtBQUV2QixlQUFPLEdBQUcsVUFBQyxVQUFVO0lBQzVCLElBQUksSUFBSSxHQUFHLE9BQU8sQ0FBQyxDQUFDLENBQUMsS0FBSyxFQUFFLENBQUM7SUFDN0IsT0FBTyxDQUFDLFNBQVMsQ0FBQyxHQU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