2016-05-30 00:28:47 +00:00
|
|
|
import "typings-global";
|
|
|
|
import * as plugins from "./npmci.plugins";
|
2016-05-30 01:40:07 +00:00
|
|
|
import {bash} from "./npmci.bash";
|
|
|
|
|
2016-05-29 20:54:59 +00:00
|
|
|
export let install = (versionArg) => {
|
2016-05-30 00:28:47 +00:00
|
|
|
let done = plugins.q.defer();
|
2016-06-01 03:42:37 +00:00
|
|
|
plugins.beautylog.log("now installing " + "node ".green + ("version " + versionArg).yellow);
|
2016-05-30 00:28:47 +00:00
|
|
|
let version:string;
|
2016-05-30 04:05:13 +00:00
|
|
|
if(versionArg == "lts"){
|
2016-05-30 00:28:47 +00:00
|
|
|
version = "4";
|
2016-06-01 03:42:37 +00:00
|
|
|
} else if(versionArg = "legacy"){
|
|
|
|
version = "4.0.0"
|
2016-05-30 00:28:47 +00:00
|
|
|
} else {
|
|
|
|
version = versionArg;
|
|
|
|
};
|
2016-05-30 01:40:07 +00:00
|
|
|
bash(
|
|
|
|
"nvm install " + version +
|
2016-05-30 02:12:15 +00:00
|
|
|
" && nvm alias default " + version
|
2016-05-30 00:28:47 +00:00
|
|
|
);
|
|
|
|
plugins.beautylog.success("Node version " + version + " successfully installed!");
|
2016-05-30 01:53:37 +00:00
|
|
|
bash("node -v");
|
|
|
|
bash("npm -v");
|
2016-05-30 00:28:47 +00:00
|
|
|
done.resolve();
|
|
|
|
return done.promise;
|
2016-05-29 20:54:59 +00:00
|
|
|
}
|