devcontainer: Support arch other than linux-x64

Signed-off-by: nicole mikołajczyk <git@mkljczk.pl>
This commit is contained in:
nicole mikołajczyk
2026-03-31 21:41:05 +00:00
parent 24b6f75875
commit 20c1044f69
2 changed files with 25 additions and 1 deletions

View File

@@ -22,7 +22,7 @@
}
},
"postCreateCommand": "bash -lc \"set -euo pipefail; corepack enable; mkdir -p ~/.local/bin; curl -fsSL https://github.com/formatjs/formatjs/releases/download/formatjs_cli_v1.1.0/formatjs_cli-linux-x64 -o ~/.local/bin/formatjs; chmod +x ~/.local/bin/formatjs; pnpm install --ignore-scripts\"",
"postCreateCommand": "bash .devcontainer/post-create.sh",
"customizations": {
"vscode": {

View File

@@ -0,0 +1,24 @@
#!/usr/bin/env bash
set -euo pipefail
corepack enable
mkdir -p ~/.local/bin
platform="$(uname -s)-$(uname -m)"
formatjs_url=""
case "$platform" in
Linux-x86_64)
formatjs_url="https://github.com/formatjs/formatjs/releases/download/formatjs_cli_v1.1.0/formatjs_cli-linux-x64"
;;
Darwin-arm64)
formatjs_url="https://github.com/formatjs/formatjs/releases/download/formatjs_cli_v1.1.0/formatjs_cli-darwin-arm64"
;;
esac
if [[ -n "$formatjs_url" ]]; then
curl -fsSL "$formatjs_url" -o ~/.local/bin/formatjs
chmod +x ~/.local/bin/formatjs
fi
pnpm install --ignore-scripts