weehong hat die Gist bearbeitet 6 days ago. Zu Änderung gehen
2 files changed, 18 insertions, 2 deletions
README.md
| @@ -24,8 +24,11 @@ bash <(curl -sSL https://opengist.rmrf.online/weehong/b2a7c0a2ae6d40e8a14f8d8596 | |||
| 24 | 24 | # 2. Install remote recommendation JSON to the default profile | |
| 25 | 25 | bash <(curl -sSL https://opengist.rmrf.online/weehong/b2a7c0a2ae6d40e8a14f8d85964a9186/raw/HEAD/install.sh) -f "https://opengist.rmrf.online/weehong/b2a7c0a2ae6d40e8a14f8d85964a9186/raw/HEAD/typescript_react_recommendation.json" | |
| 26 | 26 | ||
| 27 | - | # 3. Install remote recommendation JSON to a specific named profile | |
| 28 | - | bash <(curl -sSL https://opengist.rmrf.online/weehong/b2a7c0a2ae6d40e8a14f8d85964a9186/raw/HEAD/install.sh) -p "Frontend-Stack" -f "https://opengist.rmrf.online/weehong/b2a7c0a2ae6d40e8a14f8d85964a9186/raw/HEAD/typescript_react_recommendation.json" | |
| 27 | + | # 3. Install TypeScript and React remote recommendation JSON to a specific named profile | |
| 28 | + | bash <(curl -sSL https://opengist.rmrf.online/weehong/b2a7c0a2ae6d40e8a14f8d85964a9186/raw/HEAD/install.sh) -p "TypeScript" -f "https://opengist.rmrf.online/weehong/b2a7c0a2ae6d40e8a14f8d85964a9186/raw/HEAD/typescript_react_recommendation.json" | |
| 29 | + | ||
| 30 | + | # 4. Install Python remote recommendation JSON to a specific named profile | |
| 31 | + | bash <(curl -sSL https://opengist.rmrf.online/weehong/b2a7c0a2ae6d40e8a14f8d85964a9186/raw/HEAD/install.sh) -p "Python" -f "https://opengist.rmrf.online/weehong/b2a7c0a2ae6d40e8a14f8d85964a9186/raw/HEAD/python_recommendation.json" | |
| 29 | 32 | ``` | |
| 30 | 33 | ||
| 31 | 34 | ```powershell | |
python_recommendation.json(Datei erstellt)
| @@ -0,0 +1,13 @@ | |||
| 1 | + | { | |
| 2 | + | "recommendations": [ | |
| 3 | + | "ms-python.python", | |
| 4 | + | "ms-python.vscode-pylance", | |
| 5 | + | "charliermarsh.ruff", | |
| 6 | + | "usernamehw.errorlens", | |
| 7 | + | "mikestead.dotenv", | |
| 8 | + | "donjayamanne.python-environment-manager", | |
| 9 | + | "rangav.vscode-thunder-client", | |
| 10 | + | "njpwerner.autodocstring", | |
| 11 | + | "eamodio.gitlens" | |
| 12 | + | ] | |
| 13 | + | } | |
weehong hat die Gist bearbeitet 1 week ago. Zu Änderung gehen
1 file changed, 1 insertion, 1 deletion
install.sh
| @@ -11,7 +11,7 @@ | |||
| 11 | 11 | set -euo pipefail | |
| 12 | 12 | IFS=$'\n\t' | |
| 13 | 13 | ||
| 14 | - | readonly EXTENSIONS=( | |
| 14 | + | EXTENSIONS=( | |
| 15 | 15 | "docker.docker" | |
| 16 | 16 | "github.github-vscode-theme" | |
| 17 | 17 | "GitHub.vscode-github-actions" | |
weehong hat die Gist bearbeitet 1 week ago. Zu Änderung gehen
1 file changed, 11 insertions, 9 deletions
install.sh
| @@ -92,14 +92,14 @@ fi | |||
| 92 | 92 | # 3. Resolve JSON Source (Local File vs URL) | |
| 93 | 93 | JSON_FILE="" | |
| 94 | 94 | TEMP_JSON_FILE="" | |
| 95 | + | USE_HARDCODED=false | |
| 95 | 96 | ||
| 96 | 97 | if [[ -z "$SOURCE" ]]; then | |
| 97 | 98 | if [[ -f ".vscode/extensions.json" ]]; then | |
| 98 | 99 | JSON_FILE=".vscode/extensions.json" | |
| 99 | 100 | else | |
| 100 | - | echo "Error: No JSON file specified and .vscode/extensions.json not found." >&2 | |
| 101 | - | usage >&2 | |
| 102 | - | exit 2 | |
| 101 | + | echo "Info: No JSON file specified and .vscode/extensions.json not found. Using hardcoded extensions." >&2 | |
| 102 | + | USE_HARDCODED=true | |
| 103 | 103 | fi | |
| 104 | 104 | elif [[ "$SOURCE" =~ ^https?:// ]]; then | |
| 105 | 105 | if ! command -v curl >/dev/null 2>&1; then | |
| @@ -118,12 +118,14 @@ else | |||
| 118 | 118 | fi | |
| 119 | 119 | fi | |
| 120 | 120 | ||
| 121 | - | # 4. Extract extensions from JSON using jq | |
| 122 | - | mapfile -t EXTENSIONS < <(jq -r '.recommendations[]?' "$JSON_FILE") | |
| 123 | - | ||
| 124 | - | if [[ ${#EXTENSIONS[@]} -eq 0 ]]; then | |
| 125 | - | echo "Error: No extensions found under the 'recommendations' key." >&2 | |
| 126 | - | exit 1 | |
| 121 | + | # 4. Extract extensions from JSON using jq (if not using hardcoded array) | |
| 122 | + | if [[ "$USE_HARDCODED" == false ]]; then | |
| 123 | + | mapfile -t EXTENSIONS < <(jq -r '.recommendations[]?' "$JSON_FILE") | |
| 124 | + | ||
| 125 | + | if [[ ${#EXTENSIONS[@]} -eq 0 ]]; then | |
| 126 | + | echo "Error: No extensions found under the 'recommendations' key." >&2 | |
| 127 | + | exit 1 | |
| 128 | + | fi | |
| 127 | 129 | fi | |
| 128 | 130 | ||
| 129 | 131 | declare -a CODE_ARGS=() | |
weehong hat die Gist bearbeitet 1 week ago. Zu Änderung gehen
1 file changed, 8 insertions
install.sh
| @@ -11,6 +11,14 @@ | |||
| 11 | 11 | set -euo pipefail | |
| 12 | 12 | IFS=$'\n\t' | |
| 13 | 13 | ||
| 14 | + | readonly EXTENSIONS=( | |
| 15 | + | "docker.docker" | |
| 16 | + | "github.github-vscode-theme" | |
| 17 | + | "GitHub.vscode-github-actions" | |
| 18 | + | "ms-azuretools.vscode-containers" | |
| 19 | + | "ms-vscode-remote.vscode-remote-extensionpack" | |
| 20 | + | "pkief.material-icon-theme" | |
| 21 | + | ) | |
| 14 | 22 | PROFILE="" | |
| 15 | 23 | SOURCE="" | |
| 16 | 24 | ||
weehong hat die Gist bearbeitet 1 week ago. Zu Änderung gehen
3 files changed, 7 insertions, 1 deletion
README.md
| @@ -56,6 +56,8 @@ iwr -useb https://opengist.rmrf.online/weehong/b2a7c0a2ae6d40e8a14f8d85964a9186/ | |||
| 56 | 56 | ||
| 57 | 57 | - `docker.docker` | |
| 58 | 58 | - `github.github-vscode-theme` | |
| 59 | + | - `GitHub.vscode-github-actions` | |
| 60 | + | - `ms-azuretools.vscode-containers` | |
| 59 | 61 | - `ms-vscode-remote.vscode-remote-extensionpack` | |
| 60 | 62 | - `pkief.material-icon-theme` | |
| 61 | 63 | ||
install.ps1
| @@ -44,6 +44,8 @@ $ErrorActionPreference = 'Stop' | |||
| 44 | 44 | $Extensions = @( | |
| 45 | 45 | 'docker.docker', | |
| 46 | 46 | 'github.github-vscode-theme', | |
| 47 | + | 'GitHub.vscode-github-actions', | |
| 48 | + | 'ms-azuretools.vscode-containers', | |
| 47 | 49 | 'ms-vscode-remote.vscode-remote-extensionpack', | |
| 48 | 50 | 'pkief.material-icon-theme' | |
| 49 | 51 | ) | |
typescript_react_recommendation.json
| @@ -12,7 +12,9 @@ | |||
| 12 | 12 | "usernamehw.errorlens", | |
| 13 | 13 | "eamodio.gitlens", | |
| 14 | 14 | "formulahendry.auto-rename-tag", | |
| 15 | + | "GitHub.vscode-github-actions", | |
| 16 | + | "ms-azuretools.vscode-containers", | |
| 15 | 17 | "GitHub.copilot", | |
| 16 | 18 | "Codeium.codeium" | |
| 17 | 19 | ] | |
| 18 | - | } | |
| 20 | + | } | |
weehong hat die Gist bearbeitet 2 weeks ago. Zu Änderung gehen
1 file changed, 2 deletions
typescript_react_recommendation.json
| @@ -3,7 +3,6 @@ | |||
| 3 | 3 | "dsznajder.es7-react-js-snippets", | |
| 4 | 4 | "planbcoding.vscode-react-refactor", | |
| 5 | 5 | "bradlc.vscode-tailwindcss", | |
| 6 | - | "WallabyJs.console-ninja", | |
| 7 | 6 | "ms-vscode.vscode-typescript-next", | |
| 8 | 7 | "yoavbls.pretty-ts-errors", | |
| 9 | 8 | "christian-kohler.path-intellisense", | |
| @@ -12,7 +11,6 @@ | |||
| 12 | 11 | "esbenp.prettier-vscode", | |
| 13 | 12 | "usernamehw.errorlens", | |
| 14 | 13 | "eamodio.gitlens", | |
| 15 | - | "rangav.vscode-thunder-client", | |
| 16 | 14 | "formulahendry.auto-rename-tag", | |
| 17 | 15 | "GitHub.copilot", | |
| 18 | 16 | "Codeium.codeium" | |
weehong hat die Gist bearbeitet 2 weeks ago. Zu Änderung gehen
1 file changed, 6 insertions, 6 deletions
README.md
| @@ -18,14 +18,14 @@ Replace `<GIST>` with the raw base of this Gist (everything up to and including | |||
| 18 | 18 | ### VS Code | |
| 19 | 19 | ||
| 20 | 20 | ```bash | |
| 21 | - | # macOS / Ubuntu (default profile) | |
| 22 | - | curl -sSL https://opengist.rmrf.online/weehong/b2a7c0a2ae6d40e8a14f8d85964a9186/raw/HEAD/install.sh | bash | |
| 21 | + | # 1. macOS / Ubuntu (Install to default profile from a LOCAL .vscode/extensions.json) | |
| 22 | + | bash <(curl -sSL https://opengist.rmrf.online/weehong/b2a7c0a2ae6d40e8a14f8d85964a9186/raw/HEAD/install.sh) | |
| 23 | 23 | ||
| 24 | - | # Install recommendation plugin to a specific profile | |
| 25 | - | ./install.sh -p "Frontend-Stack" -f "https://opengist.rmrf.online/weehong/b2a7c0a2ae6d40e8a14f8d85964a9186/raw/HEAD/typescript_react_recommendation.json" | |
| 24 | + | # 2. Install remote recommendation JSON to the default profile | |
| 25 | + | bash <(curl -sSL https://opengist.rmrf.online/weehong/b2a7c0a2ae6d40e8a14f8d85964a9186/raw/HEAD/install.sh) -f "https://opengist.rmrf.online/weehong/b2a7c0a2ae6d40e8a14f8d85964a9186/raw/HEAD/typescript_react_recommendation.json" | |
| 26 | 26 | ||
| 27 | - | # named profile | |
| 28 | - | bash <(curl -sSL https://opengist.rmrf.online/weehong/b2a7c0a2ae6d40e8a14f8d85964a9186/raw/HEAD/install.sh) --profile "WorkSetup" | |
| 27 | + | # 3. Install remote recommendation JSON to a specific named profile | |
| 28 | + | bash <(curl -sSL https://opengist.rmrf.online/weehong/b2a7c0a2ae6d40e8a14f8d85964a9186/raw/HEAD/install.sh) -p "Frontend-Stack" -f "https://opengist.rmrf.online/weehong/b2a7c0a2ae6d40e8a14f8d85964a9186/raw/HEAD/typescript_react_recommendation.json" | |
| 29 | 29 | ``` | |
| 30 | 30 | ||
| 31 | 31 | ```powershell | |
weehong hat die Gist bearbeitet 2 weeks ago. Zu Änderung gehen
2 files changed, 69 insertions, 23 deletions
README.md
| @@ -21,6 +21,9 @@ Replace `<GIST>` with the raw base of this Gist (everything up to and including | |||
| 21 | 21 | # macOS / Ubuntu (default profile) | |
| 22 | 22 | curl -sSL https://opengist.rmrf.online/weehong/b2a7c0a2ae6d40e8a14f8d85964a9186/raw/HEAD/install.sh | bash | |
| 23 | 23 | ||
| 24 | + | # Install recommendation plugin to a specific profile | |
| 25 | + | ./install.sh -p "Frontend-Stack" -f "https://opengist.rmrf.online/weehong/b2a7c0a2ae6d40e8a14f8d85964a9186/raw/HEAD/typescript_react_recommendation.json" | |
| 26 | + | ||
| 24 | 27 | # named profile | |
| 25 | 28 | bash <(curl -sSL https://opengist.rmrf.online/weehong/b2a7c0a2ae6d40e8a14f8d85964a9186/raw/HEAD/install.sh) --profile "WorkSetup" | |
| 26 | 29 | ``` | |
install.sh
| @@ -3,34 +3,27 @@ | |||
| 3 | 3 | # VS Code extension installer for macOS and Linux (Ubuntu). | |
| 4 | 4 | # | |
| 5 | 5 | # Usage: | |
| 6 | - | # ./install.sh # install into the default profile | |
| 7 | - | # ./install.sh --profile "MyProfile" # install into a named profile | |
| 8 | - | # ./install.sh --help | |
| 9 | - | # | |
| 10 | - | # If --profile is provided and the profile does not exist, VS Code creates | |
| 11 | - | # it automatically. Quote names that contain spaces. | |
| 6 | + | # ./install.sh # looks for .vscode/extensions.json | |
| 7 | + | # ./install.sh -f extensions.json # specify a local JSON file | |
| 8 | + | # ./install.sh -f https://link-to-your/ext.json # specify a remote URL directly | |
| 9 | + | # ./install.sh -p "MyProfile" -f <source> # install into a named profile | |
| 12 | 10 | ||
| 13 | 11 | set -euo pipefail | |
| 14 | 12 | IFS=$'\n\t' | |
| 15 | 13 | ||
| 16 | - | readonly EXTENSIONS=( | |
| 17 | - | "docker.docker" | |
| 18 | - | "github.github-vscode-theme" | |
| 19 | - | "ms-vscode-remote.vscode-remote-extensionpack" | |
| 20 | - | "pkief.material-icon-theme" | |
| 21 | - | ) | |
| 22 | - | ||
| 23 | 14 | PROFILE="" | |
| 15 | + | SOURCE="" | |
| 24 | 16 | ||
| 25 | 17 | usage() { | |
| 26 | 18 | cat <<EOF | |
| 27 | - | Usage: $(basename "$0") [--profile "ProfileName"] | |
| 19 | + | Usage: $(basename "$0") [--profile "ProfileName"] [--file "extensions.json" | "https://..."] | |
| 28 | 20 | ||
| 29 | - | Installs a curated list of VS Code extensions on macOS or Linux. | |
| 21 | + | Installs a curated list of VS Code extensions on macOS or Linux from a local JSON file or URL. | |
| 30 | 22 | ||
| 31 | 23 | Options: | |
| 32 | 24 | -p, --profile <name> Install into the named VS Code profile. | |
| 33 | - | VS Code creates the profile if it doesn't exist. | |
| 25 | + | -f, --file <path/url> Path or URL to the JSON file containing recommendations. | |
| 26 | + | Defaults to .vscode/extensions.json if it exists. | |
| 34 | 27 | -h, --help Show this help and exit. | |
| 35 | 28 | EOF | |
| 36 | 29 | } | |
| @@ -45,6 +38,14 @@ while [[ $# -gt 0 ]]; do | |||
| 45 | 38 | PROFILE="$2" | |
| 46 | 39 | shift 2 | |
| 47 | 40 | ;; | |
| 41 | + | -f|--file) | |
| 42 | + | if [[ $# -lt 2 || -z "${2:-}" ]]; then | |
| 43 | + | echo "Error: --file requires a non-empty value." >&2 | |
| 44 | + | exit 2 | |
| 45 | + | fi | |
| 46 | + | SOURCE="$2" | |
| 47 | + | shift 2 | |
| 48 | + | ;; | |
| 48 | 49 | -h|--help) | |
| 49 | 50 | usage | |
| 50 | 51 | exit 0 | |
| @@ -66,25 +67,65 @@ case "$OS" in | |||
| 66 | 67 | ;; | |
| 67 | 68 | esac | |
| 68 | 69 | ||
| 70 | + | # 1. Check for 'code' command | |
| 69 | 71 | if ! command -v code >/dev/null 2>&1; then | |
| 70 | 72 | cat >&2 <<'EOF' | |
| 71 | 73 | Error: the 'code' command is not on your PATH. | |
| 72 | - | ||
| 73 | - | macOS: open VS Code, press Cmd+Shift+P, run | |
| 74 | - | "Shell Command: Install 'code' command in PATH". | |
| 75 | - | Linux: install VS Code from https://code.visualstudio.com/ | |
| 76 | - | (or: sudo snap install --classic code), then reopen your shell. | |
| 77 | 74 | EOF | |
| 78 | 75 | exit 1 | |
| 79 | 76 | fi | |
| 80 | 77 | ||
| 78 | + | # 2. Check for 'jq' command | |
| 79 | + | if ! command -v jq >/dev/null 2>&1; then | |
| 80 | + | echo "Error: 'jq' is not installed. (Ubuntu: sudo apt-get install jq)" >&2 | |
| 81 | + | exit 1 | |
| 82 | + | fi | |
| 83 | + | ||
| 84 | + | # 3. Resolve JSON Source (Local File vs URL) | |
| 85 | + | JSON_FILE="" | |
| 86 | + | TEMP_JSON_FILE="" | |
| 87 | + | ||
| 88 | + | if [[ -z "$SOURCE" ]]; then | |
| 89 | + | if [[ -f ".vscode/extensions.json" ]]; then | |
| 90 | + | JSON_FILE=".vscode/extensions.json" | |
| 91 | + | else | |
| 92 | + | echo "Error: No JSON file specified and .vscode/extensions.json not found." >&2 | |
| 93 | + | usage >&2 | |
| 94 | + | exit 2 | |
| 95 | + | fi | |
| 96 | + | elif [[ "$SOURCE" =~ ^https?:// ]]; then | |
| 97 | + | if ! command -v curl >/dev/null 2>&1; then | |
| 98 | + | echo "Error: 'curl' is required to download remote JSON files." >&2 | |
| 99 | + | exit 1 | |
| 100 | + | fi | |
| 101 | + | echo "Downloading JSON from URL..." | |
| 102 | + | JSON_FILE="$(mktemp -t vscode-json.XXXXXX)" | |
| 103 | + | TEMP_JSON_FILE="$JSON_FILE" | |
| 104 | + | curl -sSL "$SOURCE" -o "$JSON_FILE" | |
| 105 | + | else | |
| 106 | + | JSON_FILE="$SOURCE" | |
| 107 | + | if [[ ! -f "$JSON_FILE" ]]; then | |
| 108 | + | echo "Error: File '$JSON_FILE' does not exist." >&2 | |
| 109 | + | exit 1 | |
| 110 | + | fi | |
| 111 | + | fi | |
| 112 | + | ||
| 113 | + | # 4. Extract extensions from JSON using jq | |
| 114 | + | mapfile -t EXTENSIONS < <(jq -r '.recommendations[]?' "$JSON_FILE") | |
| 115 | + | ||
| 116 | + | if [[ ${#EXTENSIONS[@]} -eq 0 ]]; then | |
| 117 | + | echo "Error: No extensions found under the 'recommendations' key." >&2 | |
| 118 | + | exit 1 | |
| 119 | + | fi | |
| 120 | + | ||
| 81 | 121 | declare -a CODE_ARGS=() | |
| 82 | 122 | if [[ -n "$PROFILE" ]]; then | |
| 83 | 123 | CODE_ARGS+=("--profile" "$PROFILE") | |
| 84 | 124 | fi | |
| 85 | 125 | ||
| 126 | + | # Trap to clean up logs and temporary downloaded JSON files | |
| 86 | 127 | LOG_FILE="$(mktemp -t vscode-install.XXXXXX)" | |
| 87 | - | trap 'rm -f "$LOG_FILE"' EXIT | |
| 128 | + | trap 'rm -f "$LOG_FILE" $TEMP_JSON_FILE' EXIT | |
| 88 | 129 | ||
| 89 | 130 | header="Installing ${#EXTENSIONS[@]} extension(s)" | |
| 90 | 131 | [[ -n "$PROFILE" ]] && header+=" into profile '$PROFILE'" | |
| @@ -96,6 +137,8 @@ failed=0 | |||
| 96 | 137 | declare -a FAILED_LIST=() | |
| 97 | 138 | ||
| 98 | 139 | for ext in "${EXTENSIONS[@]}"; do | |
| 140 | + | [[ -z "$ext" ]] && continue | |
| 141 | + | ||
| 99 | 142 | printf ' -> %-55s ' "$ext" | |
| 100 | 143 | if code "${CODE_ARGS[@]}" --install-extension "$ext" --force >"$LOG_FILE" 2>&1; then | |
| 101 | 144 | echo "ok" | |
| @@ -117,4 +160,4 @@ if (( failed > 0 )); then | |||
| 117 | 160 | echo " - $f" >&2 | |
| 118 | 161 | done | |
| 119 | 162 | exit 1 | |
| 120 | - | fi | |
| 163 | + | fi | |
weehong hat die Gist bearbeitet 2 weeks ago. Zu Änderung gehen
1 file changed, 20 insertions
typescript_react_recommendation.json(Datei erstellt)
| @@ -0,0 +1,20 @@ | |||
| 1 | + | { | |
| 2 | + | "recommendations": [ | |
| 3 | + | "dsznajder.es7-react-js-snippets", | |
| 4 | + | "planbcoding.vscode-react-refactor", | |
| 5 | + | "bradlc.vscode-tailwindcss", | |
| 6 | + | "WallabyJs.console-ninja", | |
| 7 | + | "ms-vscode.vscode-typescript-next", | |
| 8 | + | "yoavbls.pretty-ts-errors", | |
| 9 | + | "christian-kohler.path-intellisense", | |
| 10 | + | "christian-kohler.npm-intellisense", | |
| 11 | + | "dbaeumer.vscode-eslint", | |
| 12 | + | "esbenp.prettier-vscode", | |
| 13 | + | "usernamehw.errorlens", | |
| 14 | + | "eamodio.gitlens", | |
| 15 | + | "rangav.vscode-thunder-client", | |
| 16 | + | "formulahendry.auto-rename-tag", | |
| 17 | + | "GitHub.copilot", | |
| 18 | + | "Codeium.codeium" | |
| 19 | + | ] | |
| 20 | + | } | |
weehong hat die Gist bearbeitet 2 weeks ago. Zu Änderung gehen
1 file changed, 20 deletions
typescript_react.json (Datei gelöscht)
| @@ -1,20 +0,0 @@ | |||
| 1 | - | { | |
| 2 | - | "recommendations": [ | |
| 3 | - | "dsznajder.es7-react-js-snippets", | |
| 4 | - | "planbcoding.vscode-react-refactor", | |
| 5 | - | "bradlc.vscode-tailwindcss", | |
| 6 | - | "WallabyJs.console-ninja", | |
| 7 | - | "ms-vscode.vscode-typescript-next", | |
| 8 | - | "yoavbls.pretty-ts-errors", | |
| 9 | - | "christian-kohler.path-intellisense", | |
| 10 | - | "christian-kohler.npm-intellisense", | |
| 11 | - | "dbaeumer.vscode-eslint", | |
| 12 | - | "esbenp.prettier-vscode", | |
| 13 | - | "usernamehw.errorlens", | |
| 14 | - | "eamodio.gitlens", | |
| 15 | - | "rangav.vscode-thunder-client", | |
| 16 | - | "formulahendry.auto-rename-tag", | |
| 17 | - | "GitHub.copilot", | |
| 18 | - | "Codeium.codeium" | |
| 19 | - | ] | |
| 20 | - | } | |