managarten/scripts
Wuesteon aab8c73a9c feat: add multi-layered runtime config protection system
Add comprehensive defense system to prevent runtime config bugs across all projects:

## 1. Enhanced ESLint Rules
- Added @typescript-eslint/no-floating-promises (error)
  Catches: fetch(`${getAuthUrl()}/api`) without await
- Added @typescript-eslint/no-misused-promises (error)
  Catches: Promises in conditionals and logical expressions
- Added @typescript-eslint/require-await (warn)
  Ensures async functions actually use await

## 2. Validation Script (scripts/validate-runtime-config.mjs)
Automated checker that scans all web apps for:
-  Required files (runtime.ts, docker-entrypoint.sh, Dockerfile)
-  Window injection patterns (window.__PUBLIC_*)
-  Build-time env usage in stores/api (import.meta.env.PUBLIC_*)
-  Missing await on async config functions
- ⚠️  Docker entrypoint best practices

Usage: pnpm validate:runtime-config

## 3. Comprehensive Documentation (docs/RUNTIME_CONFIG.md)
Complete implementation guide covering:
- Why runtime configuration is needed
- Step-by-step implementation guide
- Common patterns (API clients, auth stores)
- Anti-patterns to avoid
- Migration checklist
- ESLint protection details

## Benefits
- Prevents "[object Promise]" in API URLs (staging bug)
- Catches missing await at lint time
- Validates all apps automatically
- Clear documentation for new projects
- Can run in CI/CD

## Future Work
- Add to pre-push hook (optional)
- Create project generator/template
- Shared runtime config package

This prevents the class of bugs we just fixed in manacore-web where
getAuthUrl() was called without await, causing ERR_CONNECTION_REFUSED
on staging.
2025-12-16 00:28:57 +01:00
..
deploy first implementation 2025-11-27 17:26:18 +01:00
build-changed-apps.sh 🔧 chore: add pre-push build validation for changed apps 2025-12-15 19:49:30 +01:00
build-check-staged.sh 🔧 chore: add svelte-check to pre-commit hooks 2025-12-15 17:53:52 +01:00
fix-mixed-imports.mjs Fix wrong type 2025-12-04 23:25:25 +01:00
generate-env.mjs 🔧 refactor: implement 12-factor runtime config for all web apps 2025-12-15 21:33:50 +01:00
generate-staging-secrets.sh ♻️ refactor(cd): hardcode non-sensitive config in staging workflow 2025-12-04 17:11:36 +01:00
get-ssh-key.sh ♻️ refactor(cd): hardcode non-sensitive config in staging workflow 2025-12-04 17:11:36 +01:00
remove-coolify-references.sh feat: major update with network graphs, themes, todo extensions, and more 2025-12-10 02:37:46 +01:00
setup-databases.sh 🧑‍💻 dx: add automatic database setup and dev:*:full commands 2025-12-08 14:38:18 +01:00
svelte-check-staged.sh ️ fix: resolve all svelte-check a11y warnings across web apps 2025-12-15 19:09:01 +01:00
validate-runtime-config.mjs feat: add multi-layered runtime config protection system 2025-12-16 00:28:57 +01:00