feat: make playwright optional
CI / verify (pull_request) Successful in 8s

This commit is contained in:
2026-09-15 10:18:43 +02:00
parent 1bc5c329a8
commit f6cae21bfa
8 changed files with 93 additions and 14 deletions
+16 -3
View File
@@ -1,6 +1,15 @@
#!/usr/bin/env bash
set -euo pipefail
playwright=false
if (($#)); then
if [[ "$#" -ne 1 || "$1" != "--playwright" ]]; then
printf 'Usage: %s [--playwright]\n' "$0" >&2
exit 2
fi
playwright=true
fi
for command in bun jq; do
command -v "$command" >/dev/null || { printf 'Required command not found: %s\n' "$command" >&2; exit 1; }
done
@@ -43,15 +52,19 @@ if [[ ! -e "$config_source" ]]; then
config_source="$install/empty-config.json"
printf '{}\n' > "$config_source"
fi
jq -e '
jq -e --argjson playwright "$playwright" '
if type != "object" then error("opencode.json must contain an object") else . end
| if (.plugins // []) | type != "array" then error("opencode.json plugins must be an array") else . end
| .["$schema"] = (.["$schema"] // "https://opencode.ai/config.json")
| .plugins = (.plugins // [])
| if any(.plugins[]?; .package == "./plugins/stanp-opencode") then . else
| if any(.plugins[]?; .package == "./plugins/stanp-opencode") then
if $playwright then
.plugins |= map(if .package == "./plugins/stanp-opencode" then .options = ((.options // {}) + { playwright: true }) else . end)
else . end
else
.plugins += [{
package: "./plugins/stanp-opencode",
options: { mode: "gpt", provider: "openai", lunaPriority: true }
options: ({ mode: "gpt", provider: "openai", lunaPriority: true } + if $playwright then { playwright: true } else {} end)
}]
end
' "$config_source" > "$install/opencode.json"