From 95428af997af799b2695846a437e3e2193d67d3f Mon Sep 17 00:00:00 2001 From: Wildan M Date: Tue, 14 May 2024 17:05:45 +0700 Subject: [PATCH] Pathman is installed system-wide now --- package-lock.json | 4 ++-- package.json | 2 +- src/executor/runnercode.js | 19 +------------------ 3 files changed, 4 insertions(+), 21 deletions(-) diff --git a/package-lock.json b/package-lock.json index 9ff8e7d..e2a72d6 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "domcloud-bridge", - "version": "0.47.0", + "version": "0.48.0", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "domcloud-bridge", - "version": "0.47.0", + "version": "0.48.0", "license": "MIT", "dependencies": { "axios": "^1.6.8", diff --git a/package.json b/package.json index 29cddbc..6c4ddb2 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "domcloud-bridge", - "version": "0.47.0", + "version": "0.48.0", "description": "Deployment runner for DOM Cloud", "main": "app.js", "engines": { diff --git a/src/executor/runnercode.js b/src/executor/runnercode.js index 660bf74..90f0eb9 100644 --- a/src/executor/runnercode.js +++ b/src/executor/runnercode.js @@ -34,13 +34,11 @@ export async function runConfigCodeFeatures(key, value, writeLog, domaindata, ss if (value == 'off') { await writeLog("$> Removing Python engine"); await sshExec("rm -rf ~/.pyenv"); - await sshExec("pathman remove ~/.pyenv/bin && pathman remove ~/.pyenv/shims"); await sshExec("sed -i '/pyenv/d' ~/.bashrc"); } else { const parg = getPythonVersion(value); await writeLog("$> Changing Python engine to " + parg.version); - await sshExec("command -v pathman &> /dev/null || (curl -sS https://webinstall.dev/pathman | bash); source ~/.bashrc"); - await sshExec("command -v pyenv &> /dev/null || (curl -sS https://webinstall.dev/pyenv | bash); source ~/.config/envman/PATH.env"); + await sshExec("command -v pyenv &> /dev/null || (curl -sS https://webinstall.dev/pyenv | bash); source ~/.config/envman/PATH.env"); if (parg.binary) { await sshExec(`cd ~/tmp && mkdir -p ~/.pyenv/versions/${parg.version}`); await sshExec(`wget -O python.tar.zst "${parg.binary}" && tar -axf python.tar.zst && rm $_`); @@ -60,7 +58,6 @@ export async function runConfigCodeFeatures(key, value, writeLog, domaindata, ss await writeLog("$> Removing Node engine"); await sshExec("rm -rf ~/.local/opt/node-* ~/.local/opt/node ~/Downloads/webi/node"); await sshExec("rm -rf ~/.cache/yarn ~/.cache/node ~/.config/yarn ~/.npm"); - await sshExec("pathman remove ~/.local/opt/node/bin"); } else { if (value == "latest" || value == "current") { arg = ""; @@ -70,7 +67,6 @@ export async function runConfigCodeFeatures(key, value, writeLog, domaindata, ss arg = "@" + value; } await writeLog("$> Changing Node engine to " + (value || 'lts')); - await sshExec("command -v pathman &> /dev/null || (curl -sS https://webinstall.dev/pathman | bash) ; source ~/.bashrc"); await sshExec("pathman add .local/opt/node/bin ; source ~/.config/envman/PATH.env"); await sshExec(`curl -sS https://webinstall.dev/node${arg} | bash`); await sshExec("command -v corepack &> /dev/null || npm i -g corepack && corepack enable"); @@ -82,7 +78,6 @@ export async function runConfigCodeFeatures(key, value, writeLog, domaindata, ss if (arg == 'off') { await writeLog("$> Removing Deno engine"); await sshExec("rm -rf ~/.local/opt/deno-* ~/.deno ~/.local/bin/deno ~/Downloads/webi/deno"); - await sshExec("pathman remove ~/.deno/bin/"); } else { if (value == "latest" || value == "current") { arg = ""; @@ -92,7 +87,6 @@ export async function runConfigCodeFeatures(key, value, writeLog, domaindata, ss arg = "@" + value; } await writeLog("$> Changing Deno engine to " + (value || 'stable')); - await sshExec("command -v pathman &> /dev/null || (curl -sS https://webinstall.dev/pathman | bash) ; source ~/.bashrc"); await sshExec(`curl -sS https://webinstall.dev/deno${arg} | bash`); await sshExec("mkdir -p ~/.deno/bin/ && pathman add ~/.deno/bin/ ; source ~/.config/envman/PATH.env"); await sshExec("deno --version"); @@ -105,7 +99,6 @@ export async function runConfigCodeFeatures(key, value, writeLog, domaindata, ss await writeLog("$> Removing Golang engine"); await sshExec("chmod -R 0700 ~/.local/opt/go-*"); await sshExec("rm -rf ~/.local/opt/go-* ~/.cache/go-build ~/.local/opt/go ~/go ~/Downloads/webi/golang"); - await sshExec("pathman remove .local/opt/go/bin"); } else { if (value == "latest" || value == "current") { arg = ""; @@ -115,7 +108,6 @@ export async function runConfigCodeFeatures(key, value, writeLog, domaindata, ss arg = "@" + value; } await writeLog("$> Changing Golang engine to " + (value || 'stable')); - await sshExec("command -v pathman &> /dev/null || (curl -sS https://webinstall.dev/pathman | bash) ; source ~/.bashrc"); await sshExec(`curl -sS https://webinstall.dev/golang${arg} | WEBI__GO_ESSENTIALS=true bash ; source ~/.config/envman/PATH.env`); await sshExec("go version"); } @@ -126,10 +118,8 @@ export async function runConfigCodeFeatures(key, value, writeLog, domaindata, ss if (arg == 'off') { await writeLog("$> Removing Rust engine"); await sshExec("rustup self uninstall -y"); - await sshExec("pathman remove $HOME/.cargo/bin"); } else { await writeLog(arg ? "$> Changing Rust engine to " + arg : "$> installing Rust engine"); - await sshExec("command -v pathman &> /dev/null || (curl -sS https://webinstall.dev/pathman | bash) ; source ~/.bashrc"); await sshExec(`command -v rustup &> /dev/null || (curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain none)`); await sshExec(`pathman add $HOME/.cargo/bin ; source ~/.config/envman/PATH.env`); if (!arg || ["current", "latest", "lts"].includes(arg)) { @@ -158,7 +148,6 @@ export async function runConfigCodeFeatures(key, value, writeLog, domaindata, ss await writeLog("$> Removing Bun engine"); await sshExec("chmod -R 0700 ~/.local/opt/bun-*"); await sshExec("rm -rf ~/.local/opt/bun-* ~/.local/opt/bun ~/Downloads/webi/bun"); - await sshExec("pathman remove .local/opt/bun/bin"); } else { if (value == "latest" || value == "current" || !value || value == "lts") { arg = ""; @@ -166,7 +155,6 @@ export async function runConfigCodeFeatures(key, value, writeLog, domaindata, ss arg = "@" + value; } await writeLog("$> Changing Bun engine to " + (value || 'latest')); - await sshExec("command -v pathman &> /dev/null || (curl -sS https://webinstall.dev/pathman | bash) ; source ~/.bashrc"); await sshExec(`curl -sS https://webinstall.dev/bun${arg} | bash ; source ~/.config/envman/PATH.env`); await sshExec(`(cd ~/.local/bin/; wget -qO- https://github.com/domcloud/proxy-fix/releases/download/v0.1.3/proxy-fix-linux-amd64.tar.gz | tar xz && mv proxy-fix-linux-amd64 bunfix)`); await sshExec("bun --version"); @@ -177,7 +165,6 @@ export async function runConfigCodeFeatures(key, value, writeLog, domaindata, ss if (arg == 'off') { await writeLog("$> Removing Zig engine"); await sshExec("rm -rf ~/.local/opt/zig ~/Downloads/webi/zig"); - await sshExec("pathman remove .local/opt/zig/bin"); } else { if (value == "latest" || value == "current" || !value || value == "lts") { arg = ""; @@ -185,7 +172,6 @@ export async function runConfigCodeFeatures(key, value, writeLog, domaindata, ss arg = "@" + value; } await writeLog("$> Changing Zig engine to " + (value || 'latest')); - await sshExec("command -v pathman &> /dev/null || (curl -sS https://webinstall.dev/pathman | bash) ; source ~/.bashrc"); await sshExec(`curl -sS https://webinstall.dev/zig${arg} | bash ; source ~/.config/envman/PATH.env`); await sshExec("zig version"); } @@ -195,7 +181,6 @@ export async function runConfigCodeFeatures(key, value, writeLog, domaindata, ss if (arg == 'off') { await writeLog("$> Removing Dotnet engine"); await sshExec("rm -rf ~/.dotnet"); - await sshExec("pathman remove ~/.dotnet"); } else { if (value == "latest" || value == "current") { arg = "--version latest"; @@ -207,7 +192,6 @@ export async function runConfigCodeFeatures(key, value, writeLog, domaindata, ss arg = '--channel ' + value; } await writeLog("$> Changing Dotnet engine to " + (value || 'lts')); - await sshExec("command -v pathman &> /dev/null || (curl -sS https://webinstall.dev/pathman | bash) ; source ~/.bashrc"); await sshExec(`(curl -sS https://dotnet.microsoft.com/download/dotnet/scripts/v1/dotnet-install.sh | bash -s -- ${arg})`); await sshExec(`pathman add ~/.dotnet ; source ~/.config/envman/PATH.env`); await sshExec("dotnet --version"); @@ -226,7 +210,6 @@ export async function runConfigCodeFeatures(key, value, writeLog, domaindata, ss throw new Error(`No Java with version ${value} is available to install`); } await writeLog("$> Changing Java engine to " + jarg.version); - await sshExec("command -v pathman &> /dev/null || (curl -sS https://webinstall.dev/pathman | bash); source ~/.bashrc"); await sshExec(`cd ~/tmp && mkdir -p ~/.local/java/jdk-${jarg.version}`); await sshExec(`wget "${jarg.binary}" -O ~/tmp/jdk.tar.gz && tar -axf jdk.tar.gz && rm $_`); await sshExec(`mv ~/tmp/jdk-*/* ~/.local/java/jdk-${jarg.version} || true ; rm -rf ~/tmp/jdk-*`);