npmci/ts/npmci.install.ts

27 lines
806 B
TypeScript
Raw Permalink Normal View History

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