update nvm detection
This commit is contained in:
parent
8736530920
commit
28054b17fc
10
dist/npmci.bash.js
vendored
10
dist/npmci.bash.js
vendored
@ -4,11 +4,15 @@ const plugins = require("./npmci.plugins");
|
||||
let nvmSourceString = "";
|
||||
exports.nvmAvailable = false;
|
||||
let checkNvm = () => {
|
||||
let nvmExecCode = plugins.shelljs.exec(`bash -c "source /usr/local/nvm/nvm.sh"`).code;
|
||||
if (nvmExecCode === 0) {
|
||||
if (plugins.shelljs.exec(`bash -c "source /usr/local/nvm/nvm.sh"`, { silent: true }).code === 0) {
|
||||
nvmSourceString = `source /usr/local/nvm/nvm.sh && `;
|
||||
exports.nvmAvailable = true;
|
||||
}
|
||||
else if (plugins.shelljs.exec(`bash -c "source ~/.nvm/nvm.sh"`, { silent: true }).code === 0) {
|
||||
nvmSourceString = `source ~/.nvm/nvm.sh && `;
|
||||
exports.nvmAvailable = true;
|
||||
}
|
||||
;
|
||||
};
|
||||
checkNvm();
|
||||
exports.bash = (commandArg, retryArg = 2, bareArg = false) => {
|
||||
@ -45,4 +49,4 @@ exports.bash = (commandArg, retryArg = 2, bareArg = false) => {
|
||||
exports.bashBare = (commandArg, retryArg = 2) => {
|
||||
return exports.bash(commandArg, retryArg, true);
|
||||
};
|
||||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibnBtY2kuYmFzaC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3RzL25wbWNpLmJhc2gudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLFFBQU8sZ0JBQWdCLENBQUMsQ0FBQTtBQUN4QixNQUFZLE9BQU8sV0FBTSxpQkFBaUIsQ0FBQyxDQUFBO0FBRzNDLElBQUksZUFBZSxHQUFVLEVBQUUsQ0FBQztBQUNyQixvQkFBWSxHQUFXLEtBQUssQ0FBQztBQUN4QyxJQUFJLFFBQVEsR0FBRztJQUNYLElBQUksV0FBVyxHQUFHLE9BQU8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Z0JBQ0osT0FBTyxDQUFDLFNBQVMsQ0FBQyxJQUFJLENBQUMsbUNBQW1DLEdBQUcsUUFBUSxDQUFDLFFBQVEsRUFBRSxDQUFDLENBQUM7Z0JBQ2xGLE9BQU8sQ0FBQyxTQUFTLENBQUMsSUFBSSxDQUFDLFFBQVEsR0FBRyxDQUFDLENBQUMsR0FBRyxDQUFDLENBQUMsQ0FBQyxRQUFRLEVBQUUsR0FBRyxNQUFNLEdBQUcsUUFBUSxDQUFDLFFBQVEsRUFBRSxDQUFDLENBQUM7WUFDekYsQ0FBQztRQUNMLENBQUM7SUFDTCxDQUFDO0lBQUMsSUFBSSxDQUFDLENBQUM7UUFDSixPQUFPLENBQUMsU0FBUyxDQUFDLEdBQUcsQ0FBQyxzQkFBc0IsR0FBRyxVQUFVLENBQUMsSUFBSSxDQUFDLENBQUE7SUFDbkUsQ0FBQztJQUNELE1BQU0sQ0FBQyxNQUFNLENBQUM7QUFDbEIsQ0FBQyxDQUFBO0FBRVUsZ0JBQVEsR0FBRyxDQUFDLFVBQVUsRUFBRSxRQUFRLEdBQUcsQ0FBQztJQUMzQyxNQUFNLENBQUMsWUFBSSxDQUFDLFVBQVUsRUFBRSxRQUFRLEVBQUUsSUFBSSxDQUFDLENBQUM7QUFDNUMsQ0FBQyxDQUFBIn0=
|
14
dist/npmci.install.js
vendored
14
dist/npmci.install.js
vendored
@ -2,6 +2,7 @@
|
||||
require("typings-global");
|
||||
const plugins = require("./npmci.plugins");
|
||||
const npmci_bash_1 = require("./npmci.bash");
|
||||
const npmci_bash_2 = require("./npmci.bash");
|
||||
exports.install = (versionArg) => {
|
||||
let done = plugins.q.defer();
|
||||
plugins.beautylog.log("now installing " + "node ".green + ("version " + versionArg).yellow);
|
||||
@ -19,12 +20,17 @@ exports.install = (versionArg) => {
|
||||
version = versionArg;
|
||||
}
|
||||
;
|
||||
npmci_bash_1.bash("nvm install " + version +
|
||||
" && nvm alias default " + version);
|
||||
plugins.beautylog.success("Node version " + version + " successfully installed!");
|
||||
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!");
|
||||
}
|
||||
;
|
||||
npmci_bash_1.bash("node -v");
|
||||
npmci_bash_1.bash("npm -v");
|
||||
done.resolve();
|
||||
return done.promise;
|
||||
};
|
||||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibnBtY2kuaW5zdGFsbC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3RzL25wbWNpLmluc3RhbGwudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLFFBQU8sZ0JBQWdCLENBQUMsQ0FBQTtBQUN4QixNQUFZLE9BQU8sV0FBTSxpQkFBaUIsQ0FBQyxDQUFBO0FBQzNDLDZCQUFtQixjQUFjLENBQUMsQ0FBQTtBQUV2QixlQUFPLEdBQUcsQ0FBQyxVQUFVO0lBQzVCLElBQUksSUFBSSxHQUFHLE9BQU8sQ0FBQyxDQUFDLENBQUMsS0FBSyxFQUFFLENBQUM7SUFDN0IsT0FBTyxDQUFDLFNBQVMsQ0FBQyxHQUFHLENBQUMsaUJBQWlCLEdBQUcsT0FBTyxDQUFDLEtBQUssR0FBRyxDQUFDLFVBQVUsR0FBRyxVQUFVLENBQUMsQ0FBQyxNQUFNLENBQUMsQ0FBQztJQUM1RixJQUFJLE9BQWMsQ0FBQztJQUNuQixFQUFFLENBQUEsQ0FBQyxVQUFVLElBQUksUUFBUSxDQUFDLENBQUEsQ0FBQztRQUN2QixPQUFPLEdBQUcsT0FBTyxDQUFDO0lBQ3RCLENBQUM7SUFBQyxJQUFJLENBQUMsRUFBRSxDQUFBLENBQUMsVUFBVSxJQUFJLEtBQUssQ0FBQyxDQUFBLENBQUM7UUFDM0IsT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FDO0lBQ0YsaUJBQUksQ0FBQyxTQUFTLENBQUMsQ0FBQztJQUNoQixpQkFBSSxDQUFDLFFBQVEsQ0FBQyxDQUFDO0lBQ2YsSUFBSSxDQUFDLE9BQU8sRUFBRSxDQUFDO0lBQ2YsTUFBTSxDQUFDLElBQUksQ0FBQyxPQUFPLENBQUM7QUFDeEIsQ0FBQyxDQUFBIn0=
|
8
npmextra.json
Normal file
8
npmextra.json
Normal file
@ -0,0 +1,8 @@
|
||||
{
|
||||
"npmts":{
|
||||
"mode":"default"
|
||||
},
|
||||
"npmdocker":{
|
||||
"baseImage":"hosttoday/ht-docker-node:npmts"
|
||||
}
|
||||
}
|
@ -2,24 +2,26 @@ import "typings-global";
|
||||
import * as plugins from "./npmci.plugins";
|
||||
|
||||
|
||||
let nvmSourceString:string = "";
|
||||
export let nvmAvailable:boolean = false;
|
||||
let nvmSourceString: string = "";
|
||||
export let nvmAvailable: boolean = false;
|
||||
let checkNvm = () => {
|
||||
let nvmExecCode = plugins.shelljs.exec(`bash -c "source /usr/local/nvm/nvm.sh"`).code;
|
||||
if(nvmExecCode === 0){
|
||||
if (plugins.shelljs.exec(`bash -c "source /usr/local/nvm/nvm.sh"`,{silent:true}).code === 0) {
|
||||
nvmSourceString = `source /usr/local/nvm/nvm.sh && `
|
||||
nvmAvailable = true;
|
||||
}
|
||||
} else if (plugins.shelljs.exec(`bash -c "source ~/.nvm/nvm.sh"`,{silent:true}).code === 0) {
|
||||
nvmSourceString = `source ~/.nvm/nvm.sh && `
|
||||
nvmAvailable = true;
|
||||
};
|
||||
};
|
||||
checkNvm();
|
||||
|
||||
export let bash = (commandArg:string,retryArg = 2,bareArg = false) => {
|
||||
let exitCode:number;
|
||||
let stdOut:string;
|
||||
export let bash = (commandArg: string, retryArg = 2, bareArg = false) => {
|
||||
let exitCode: number;
|
||||
let stdOut: string;
|
||||
let execResult;
|
||||
if(!process.env.NPMTS_TEST){ // NPMTS_TEST is used during testing
|
||||
for (let i = 0; i <= retryArg; i++){
|
||||
if(!bareArg){
|
||||
if (!process.env.NPMTS_TEST) { // NPMTS_TEST is used during testing
|
||||
for (let i = 0; i <= retryArg; i++) {
|
||||
if (!bareArg) {
|
||||
execResult = plugins.shelljs.exec(
|
||||
`bash -c "${nvmSourceString} ${commandArg}"`
|
||||
);
|
||||
@ -28,13 +30,13 @@ export let bash = (commandArg:string,retryArg = 2,bareArg = false) => {
|
||||
}
|
||||
exitCode = execResult.code;
|
||||
stdOut = execResult.stdout;
|
||||
if(exitCode !== 0 && i == retryArg){
|
||||
if (exitCode !== 0 && i == retryArg) {
|
||||
process.exit(1);
|
||||
} else if(exitCode == 0){
|
||||
} else if (exitCode == 0) {
|
||||
i = retryArg + 1; // if everything works out ok retrials are not wanted
|
||||
} else {
|
||||
plugins.beautylog.warn("Something went wrong! Exit Code: " + exitCode.toString());
|
||||
plugins.beautylog.info("Retry " + (i + 1).toString() + " of " + retryArg.toString());
|
||||
plugins.beautylog.info("Retry " + (i + 1).toString() + " of " + retryArg.toString());
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@ -43,6 +45,6 @@ export let bash = (commandArg:string,retryArg = 2,bareArg = false) => {
|
||||
return stdOut;
|
||||
}
|
||||
|
||||
export let bashBare = (commandArg,retryArg = 2) => {
|
||||
return bash(commandArg,retryArg,true);
|
||||
export let bashBare = (commandArg, retryArg = 2) => {
|
||||
return bash(commandArg, retryArg, true);
|
||||
}
|
@ -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();
|
||||
|
Loading…
Reference in New Issue
Block a user