Files
q-blog/scripts/dev/patch-lint-scope.sh
2025-08-16 22:15:29 -04:00

19 lines
573 B
Bash
Executable File

#!/usr/bin/env bash
set -euo pipefail
if ! command -v jq >/dev/null 2>&1; then
echo "ERROR: jq not found" >&2
exit 1
fi
TMP=package.json.$$
# Ensure scripts exist and add lint variants
jq '.
| .scripts = (.scripts // {})
| .scripts["lint:phase0"] = "LINT_SCOPE=phase0 eslint ."
| .scripts["lint:full"] = "LINT_SCOPE=full eslint ."
| .scripts["check"] = (.scripts["check"] // "npm run typecheck && npm run lint:phase0 && npm run test:run")
' package.json > "$TMP" && mv "$TMP" package.json
echo "package.json scripts patched (lint:phase0, lint:full, check)."