chore: update devcontainer configuration and add setup scripts
All checks were successful
CI/CD Pipeline / playwright (push) Successful in 1m33s
CI/CD Pipeline / build-and-deploy (push) Successful in 1m53s
测试最新依赖 / build-and-test (push) Successful in 1m31s
测试最新依赖 / playwright (push) Successful in 2m26s

This commit is contained in:
严浩
2025-11-18 00:47:42 +08:00
parent 3affb21d99
commit e6731afff5
6 changed files with 188 additions and 187 deletions

View File

@@ -0,0 +1,36 @@
#!/bin/zsh -eu
TARGET_USER="usr_vscode"
if [[ "$EUID" -eq 0 ]]; then
target_home="/home/${TARGET_USER}"
else
target_home="$HOME"
fi
zshrc="${target_home}/.zshrc"
mkdir -p "${zshrc:h}"
touch "$zshrc"
vscode_marker='if [[ "$TERM_PROGRAM" == "vscode" ]]; then'
if ! grep -Fq "$vscode_marker" "$zshrc" 2>/dev/null; then
cat <<'EOF' >>"$zshrc"
if [[ "$TERM_PROGRAM" == "vscode" ]]; then
local vscode_executable
if command -v code >/dev/null 2>&1; then
vscode_executable="code"
elif command -v code-insiders >/dev/null 2>&1; then
vscode_executable="code-insiders"
fi
if [ -n "$vscode_executable" ]; then
. "$($vscode_executable --locate-shell-integration-path zsh)"
fi
fi
EOF
fi
alias_snippet="alias clean-node-modules='setopt rm_star_silent; rm -rf node_modules/.*; rm -rf node_modules/*'; unsetopt rm_star_silent"
if ! grep -Fqx -- "$alias_snippet" "$zshrc" 2>/dev/null; then
printf '\n%s\n' "$alias_snippet" >>"$zshrc"
fi