Skip to content

Commit

Permalink
Pathman is installed system-wide now
Browse files Browse the repository at this point in the history
  • Loading branch information
willnode committed May 14, 2024
1 parent e91f12c commit 95428af
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 21 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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": {
Expand Down
19 changes: 1 addition & 18 deletions src/executor/runnercode.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 $_`);
Expand All @@ -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 = "";
Expand All @@ -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");
Expand All @@ -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 = "";
Expand All @@ -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");
Expand All @@ -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 = "";
Expand All @@ -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");
}
Expand All @@ -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)) {
Expand Down Expand Up @@ -158,15 +148,13 @@ 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 = "";
} else {
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");
Expand All @@ -177,15 +165,13 @@ 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 = "";
} else {
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");
}
Expand All @@ -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";
Expand All @@ -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");
Expand All @@ -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-*`);
Expand Down

0 comments on commit 95428af

Please sign in to comment.