npmci/dist/npmci.install.js

26 lines
2.9 KiB
JavaScript
Raw Permalink 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();
var version;
2016-05-30 04:07:07 +00:00
if (versionArg == "lts") {
2016-05-30 00:29:30 +00:00
version = "4";
}
else {
version = versionArg;
}
;
plugins.beautylog.log("now installing " + "node ".green + ("version " + version).yellow);
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-05-30 04:07:07 +00:00
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIm5wbWNpLmluc3RhbGwudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLFFBQU8sZ0JBQWdCLENBQUMsQ0FBQTtBQUN4QixJQUFZLE9BQU8sV0FBTSxpQkFBaUIsQ0FBQyxDQUFBO0FBQzNDLDJCQUFtQixjQUFjLENBQUMsQ0FBQTtBQUV2QixlQUFPLEdBQUcsVUFBQyxVQUFVO0lBQzVCLElBQUksSUFBSSxHQUFHLE9BQU8sQ0FBQyxDQUFDLENBQUMsS0FBSyxFQUFFLENBQUM7SUFDN0IsSUFBSSxPQUFjLENBQUM7SUFDbkIsRUFBRSxDQUFBLENBQUMsVUFBVSxJQUFJLEtBQUssQ0FBQyxDQUFBLENBQUM7UUFDcEIsT0FBTyxHQUFHLEdBQUcsQ0FBQztJQUNsQixDQUFDO0lBQUMsSUFBSSxDQUFDLENBQUM7UU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