update nvm detection

This commit is contained in:
2016-08-02 23:11:42 +02:00
parent 8736530920
commit 28054b17fc
5 changed files with 56 additions and 34 deletions

View File

@@ -1,25 +1,27 @@
import "typings-global";
import * as plugins from "./npmci.plugins";
import {bash} from "./npmci.bash";
import { bash } from "./npmci.bash";
import { nvmAvailable } from "./npmci.bash"
export let install = (versionArg) => {
let done = plugins.q.defer();
plugins.beautylog.log("now installing " + "node ".green + ("version " + versionArg).yellow);
let version:string;
if(versionArg == "stable"){
let version: string;
if (versionArg == "stable") {
version = "6.3.0";
} else if(versionArg == "lts"){
} else if (versionArg == "lts") {
version = "6.3.0";
} else if(versionArg == "legacy"){
} else if (versionArg == "legacy") {
version = "6.3.0"
} else {
} else {
version = versionArg;
};
bash(
"nvm install " + version +
" && nvm alias default " + version
);
plugins.beautylog.success("Node version " + version + " successfully installed!");
if (nvmAvailable) {
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!");
};
bash("node -v");
bash("npm -v");
done.resolve();