mirror of
https://github.com/Memo-2023/mana-monorepo.git
synced 2026-05-15 20:19:39 +02:00
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.
|
||
|---|---|---|
| .. | ||
| eslint-config | ||
| mana-core-nestjs-integration | ||
| manadeck-database | ||
| news-database | ||
| nutriphi-database | ||
| shared-api-client | ||
| shared-auth | ||
| shared-auth-stores | ||
| shared-auth-ui | ||
| shared-branding | ||
| shared-config | ||
| shared-credit-service | ||
| shared-errors | ||
| shared-feedback-service | ||
| shared-feedback-types | ||
| shared-feedback-ui | ||
| shared-help-content | ||
| shared-help-mobile | ||
| shared-help-types | ||
| shared-help-ui | ||
| shared-i18n | ||
| shared-icons | ||
| shared-landing-ui | ||
| shared-nestjs-auth | ||
| shared-profile-ui | ||
| shared-splitscreen | ||
| shared-storage | ||
| shared-stores | ||
| shared-subscription-types | ||
| shared-subscription-ui | ||
| shared-supabase | ||
| shared-tags | ||
| shared-tailwind | ||
| shared-theme | ||
| shared-theme-ui | ||
| shared-types | ||
| shared-ui | ||
| shared-utils | ||
| shared-vite-config | ||
| test-config | ||
| uload-database | ||