npmci/ts/npmci.install.ts

24 lines
747 B
TypeScript
Raw Normal View History

2016-05-30 00:28:47 +00:00
import "typings-global";
import * as plugins from "./npmci.plugins";
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();
let version:string;
if(versionArg = "lts"){
version = "4";
} else {
version = versionArg;
};
plugins.beautylog.log("now installing " + "node ".green + ("version " + version).yellow);
plugins.shelljs.exec(
"bash -c \"source /usr/local/nvm/nvm.sh && nvm install "+
version +
" nvm alias default " +
version +
"\""
);
plugins.beautylog.success("Node version " + version + " successfully installed!");
2016-05-30 00:44:38 +00:00
plugins.shelljs.exec("node -v");
plugins.shelljs.exec("npm -v");
2016-05-30 00:28:47 +00:00
done.resolve();
return done.promise;
2016-05-29 20:54:59 +00:00
}