2016-05-30 00:29:30 +00:00
|
|
|
"use strict";
|
|
|
|
require("typings-global");
|
2016-07-18 14:56:53 +00:00
|
|
|
const plugins = require("./npmci.plugins");
|
|
|
|
const npmci_bash_1 = require("./npmci.bash");
|
2016-08-02 21:11:42 +00:00
|
|
|
const npmci_bash_2 = require("./npmci.bash");
|
2016-07-18 14:56:53 +00:00
|
|
|
exports.install = (versionArg) => {
|
|
|
|
let done = plugins.q.defer();
|
2016-09-04 11:42:22 +00:00
|
|
|
plugins.beautylog.log(`now installing node version ${versionArg}`);
|
2016-07-18 14:56:53 +00:00
|
|
|
let version;
|
2016-06-29 21:18:51 +00:00
|
|
|
if (versionArg == "stable") {
|
2016-09-20 10:43:37 +00:00
|
|
|
version = "6.6.0";
|
2016-06-29 21:18:51 +00:00
|
|
|
}
|
|
|
|
else if (versionArg == "lts") {
|
2016-09-20 10:43:37 +00:00
|
|
|
version = "6.6.0";
|
2016-05-30 00:29:30 +00:00
|
|
|
}
|
2016-06-01 04:04:20 +00:00
|
|
|
else if (versionArg == "legacy") {
|
2016-09-20 10:43:37 +00:00
|
|
|
version = "6.6.0";
|
2016-06-01 03:44:48 +00:00
|
|
|
}
|
2016-05-30 00:29:30 +00:00
|
|
|
else {
|
|
|
|
version = versionArg;
|
|
|
|
}
|
|
|
|
;
|
2016-08-02 21:11:42 +00:00
|
|
|
if (npmci_bash_2.nvmAvailable) {
|
|
|
|
npmci_bash_1.bash(`nvm install ${version} && nvm alias default ${version}`);
|
|
|
|
plugins.beautylog.success(`Node version ${version} successfully installed!`);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
plugins.beautylog.warn("Nvm not in path so staying at installed node version!");
|
|
|
|
}
|
|
|
|
;
|
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-09-20 10:43:37 +00:00
|
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