mirror of
https://github.com/Memo-2023/mana-monorepo.git
synced 2026-05-15 00:41:09 +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.
|
||
|---|---|---|
| .. | ||
| architecture | ||
| central-services | ||
| daily-reports | ||
| optimizable | ||
| pr-reviews | ||
| test-examples | ||
| BACKEND_ARCHITECTURE.md | ||
| CHANGELOG_2025-11-24.md | ||
| CI_CD_SETUP.md | ||
| DATABASE_MIGRATIONS.md | ||
| DEPENDENCY_ALIGNMENT.md | ||
| DEPLOYMENT.md | ||
| DEPLOYMENT_ARCHITECTURE.md | ||
| DEPLOYMENT_DIAGRAMS.md | ||
| DEPLOYMENT_HETZNER.md | ||
| DEPLOYMENT_RUNBOOKS.md | ||
| DEVELOPMENT_SCRIPTS.md | ||
| DOCKER_GUIDE.md | ||
| DOCKER_SETUP_ANALYSIS.md | ||
| ENV_AUDIT_SUMMARY.md | ||
| ENV_BACKEND_MATRIX.md | ||
| ENV_CONFIGURATION_AUDIT.md | ||
| ENVIRONMENT_VARIABLES.md | ||
| GIT_WORKFLOW.md | ||
| HETZNER_DEPLOYMENT_SUMMARY.md | ||
| HETZNER_PRODUCTION_GUIDE.md | ||
| I18N.md | ||
| LOCAL_DEVELOPMENT.md | ||
| MANADECK_POSTGRES_MIGRATION.md | ||
| PROJECT_OVERVIEW.md | ||
| PWA_GUIDE.md | ||
| README_ENV_AUDIT.md | ||
| RUNTIME_CONFIG.md | ||
| SELF-HOSTING-GUIDE.md | ||
| SETUP_TEMPLATES.md | ||
| SHARED_PACKAGES_ROADMAP.md | ||
| STAGING_DEPLOYMENT_ISSUES.md | ||
| STAGING_SETUP.md | ||
| SVELTE_CHECK_ISSUES.md | ||
| TESTING.md | ||
| TESTING_IMPLEMENTATION_GUIDE.md | ||
| TESTING_SUMMARY.md | ||
| ULOAD-DEPLOYMENT.md | ||
| USER_SETTINGS.md | ||