mirror of
https://github.com/get-drexa/drive.git
synced 2025-11-30 21:41:39 +00:00
build: add vscode ext install script
This commit is contained in:
@@ -7,9 +7,6 @@
|
|||||||
"features": {
|
"features": {
|
||||||
"ghcr.io/devcontainers/features/git:1": {},
|
"ghcr.io/devcontainers/features/git:1": {},
|
||||||
"ghcr.io/devcontainers/features/github-cli:1": {},
|
"ghcr.io/devcontainers/features/github-cli:1": {},
|
||||||
"ghcr.io/devcontainers/features/docker-in-docker:2": {
|
|
||||||
"moby": false
|
|
||||||
},
|
|
||||||
"ghcr.io/tailscale/codespace/tailscale": {
|
"ghcr.io/tailscale/codespace/tailscale": {
|
||||||
"version": "latest"
|
"version": "latest"
|
||||||
},
|
},
|
||||||
@@ -18,19 +15,14 @@
|
|||||||
"golangciLintVersion": "2.6.1"
|
"golangciLintVersion": "2.6.1"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"postCreateCommand": "./scripts/setup-git.sh",
|
"postCreateCommand": "./scripts/setup-git.sh && ./scripts/install-vscode-extensions.sh",
|
||||||
"customizations": {
|
"customizations": {
|
||||||
"vscode": {
|
"vscode": {
|
||||||
"extensions": [
|
"extensions": [
|
||||||
"biomejs.biome",
|
"biomejs.biome",
|
||||||
"bradlc.vscode-tailwindcss",
|
"bradlc.vscode-tailwindcss",
|
||||||
"ms-vscode.vscode-typescript-next",
|
|
||||||
"esbenp.prettier-vscode",
|
|
||||||
"ms-vscode.vscode-json",
|
|
||||||
"formulahendry.auto-rename-tag",
|
|
||||||
"christian-kohler.path-intellisense",
|
"christian-kohler.path-intellisense",
|
||||||
"ms-vscode.vscode-eslint",
|
"golang.go"
|
||||||
"convex.convex-vscode"
|
|
||||||
],
|
],
|
||||||
"settings": {
|
"settings": {
|
||||||
"editor.defaultFormatter": "biomejs.biome",
|
"editor.defaultFormatter": "biomejs.biome",
|
||||||
|
|||||||
54
scripts/install-vscode-extensions.sh
Executable file
54
scripts/install-vscode-extensions.sh
Executable file
@@ -0,0 +1,54 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Install VS Code extensions from devcontainer.json
|
||||||
|
# This script reads extensions from the single source of truth
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||||
|
DEVCONTAINER_JSON="$SCRIPT_DIR/../.devcontainer/devcontainer.json"
|
||||||
|
|
||||||
|
echo "Installing VS Code extensions from devcontainer.json..."
|
||||||
|
|
||||||
|
if [ ! -f "$DEVCONTAINER_JSON" ]; then
|
||||||
|
echo "Error: devcontainer.json not found at $DEVCONTAINER_JSON"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Use Bun to parse JSON and extract extensions
|
||||||
|
EXTENSIONS=$(bun -e "
|
||||||
|
const config = await Bun.file('$DEVCONTAINER_JSON').json();
|
||||||
|
const extensions = config?.customizations?.vscode?.extensions ?? [];
|
||||||
|
console.log(extensions.join('\n'));
|
||||||
|
")
|
||||||
|
|
||||||
|
if [ -z "$EXTENSIONS" ]; then
|
||||||
|
echo "No extensions found in devcontainer.json"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Determine which CLI to use (code-server, cursor, or code)
|
||||||
|
if command -v code-server &> /dev/null; then
|
||||||
|
CLI="code-server"
|
||||||
|
elif command -v cursor &> /dev/null; then
|
||||||
|
CLI="cursor"
|
||||||
|
elif command -v code &> /dev/null; then
|
||||||
|
CLI="code"
|
||||||
|
else
|
||||||
|
echo "Warning: No VS Code CLI found (code-server, cursor, or code)"
|
||||||
|
echo "Extensions to install:"
|
||||||
|
echo "$EXTENSIONS"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Using $CLI to install extensions..."
|
||||||
|
|
||||||
|
# Install each extension
|
||||||
|
echo "$EXTENSIONS" | while read -r ext; do
|
||||||
|
if [ -n "$ext" ]; then
|
||||||
|
echo "Installing: $ext"
|
||||||
|
$CLI --install-extension "$ext" 2>/dev/null || true
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
echo "Extension installation complete!"
|
||||||
Reference in New Issue
Block a user