create-fluxstack 1.0.2 → 1.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude/settings.local.json +65 -0
- package/.dockerignore +50 -0
- package/.env.example +53 -0
- package/.gitattributes +2 -0
- package/.github/workflows/ci-build-tests.yml +480 -0
- package/.github/workflows/dependency-management.yml +324 -0
- package/.github/workflows/release-validation.yml +355 -0
- package/.kiro/specs/fluxstack-architecture-optimization/design.md +700 -0
- package/.kiro/specs/fluxstack-architecture-optimization/requirements.md +127 -0
- package/.kiro/specs/fluxstack-architecture-optimization/tasks.md +330 -0
- package/CLAUDE.md +200 -0
- package/Dockerfile +58 -0
- package/Dockerfile.backend +52 -0
- package/Dockerfile.frontend +54 -0
- package/ENV_TESTING_REPORT.md +292 -0
- package/FRAMEWORK_ROADMAP.md +183 -0
- package/FRONTEND_TESTS_README.md +287 -0
- package/LICENSE +21 -0
- package/README-Docker.md +85 -0
- package/TEST_RESULTS.md +130 -0
- package/ai-context/00-QUICK-START.md +86 -0
- package/ai-context/README.md +88 -0
- package/ai-context/development/eden-treaty-guide.md +362 -0
- package/ai-context/development/patterns.md +382 -0
- package/ai-context/examples/crud-complete.md +626 -0
- package/ai-context/project/architecture.md +399 -0
- package/ai-context/project/overview.md +213 -0
- package/ai-context/recent-changes/eden-treaty-refactor.md +281 -0
- package/ai-context/recent-changes/type-inference-fix.md +223 -0
- package/ai-context/reference/environment-vars.md +384 -0
- package/ai-context/reference/troubleshooting.md +407 -0
- package/app/client/README.md +69 -0
- package/app/client/frontend-only.ts +12 -0
- package/app/client/index.html +13 -0
- package/app/client/public/vite.svg +1 -0
- package/app/client/src/App.css +883 -0
- package/app/client/src/App.tsx +669 -0
- package/app/client/src/assets/react.svg +1 -0
- package/app/client/src/components/TestPage.tsx +453 -0
- package/app/client/src/index.css +51 -0
- package/app/client/src/lib/eden-api.ts +110 -0
- package/app/client/src/main.tsx +10 -0
- package/app/client/src/vite-env.d.ts +1 -0
- package/app/client/tsconfig.app.json +43 -0
- package/app/client/tsconfig.json +7 -0
- package/app/client/tsconfig.node.json +25 -0
- package/app/server/app.ts +10 -0
- package/app/server/backend-only.ts +15 -0
- package/app/server/controllers/users.controller.ts +69 -0
- package/app/server/index.ts +104 -0
- package/app/server/routes/index.ts +25 -0
- package/app/server/routes/users.routes.ts +121 -0
- package/app/server/types/index.ts +1 -0
- package/app/shared/types/index.ts +18 -0
- package/bun.lock +1063 -0
- package/bunfig.toml +16 -0
- package/config/fluxstack.config.ts +48 -0
- package/core/__tests__/integration.test.ts +227 -0
- package/core/build/index.ts +186 -0
- package/core/cli/command-registry.ts +334 -0
- package/core/cli/index.ts +394 -0
- package/core/cli/plugin-discovery.ts +200 -0
- package/core/client/standalone.ts +57 -0
- package/core/config/__tests__/config-loader.test.ts +591 -0
- package/core/config/__tests__/config-merger.test.ts +657 -0
- package/core/config/__tests__/env-converter.test.ts +372 -0
- package/core/config/__tests__/env-processor.test.ts +431 -0
- package/core/config/__tests__/env.test.ts +452 -0
- package/core/config/__tests__/integration.test.ts +418 -0
- package/core/config/__tests__/loader.test.ts +331 -0
- package/core/config/__tests__/schema.test.ts +129 -0
- package/core/config/__tests__/validator.test.ts +318 -0
- package/core/config/env-dynamic.ts +326 -0
- package/core/config/env.ts +597 -0
- package/core/config/index.ts +317 -0
- package/core/config/loader.ts +546 -0
- package/core/config/runtime-config.ts +322 -0
- package/core/config/schema.ts +694 -0
- package/core/config/validator.ts +540 -0
- package/core/framework/__tests__/server.test.ts +233 -0
- package/core/framework/client.ts +132 -0
- package/core/framework/index.ts +8 -0
- package/core/framework/server.ts +501 -0
- package/core/framework/types.ts +63 -0
- package/core/plugins/__tests__/built-in.test.ts.disabled +366 -0
- package/core/plugins/__tests__/manager.test.ts +398 -0
- package/core/plugins/__tests__/monitoring.test.ts +401 -0
- package/core/plugins/__tests__/registry.test.ts +335 -0
- package/core/plugins/built-in/index.ts +142 -0
- package/core/plugins/built-in/logger/index.ts +180 -0
- package/core/plugins/built-in/monitoring/README.md +193 -0
- package/core/plugins/built-in/monitoring/index.ts +912 -0
- package/core/plugins/built-in/static/index.ts +289 -0
- package/core/plugins/built-in/swagger/index.ts +229 -0
- package/core/plugins/built-in/vite/index.ts +316 -0
- package/core/plugins/config.ts +348 -0
- package/core/plugins/discovery.ts +350 -0
- package/core/plugins/executor.ts +351 -0
- package/core/plugins/index.ts +195 -0
- package/core/plugins/manager.ts +583 -0
- package/core/plugins/registry.ts +424 -0
- package/core/plugins/types.ts +254 -0
- package/core/server/framework.ts +123 -0
- package/core/server/index.ts +8 -0
- package/core/server/plugins/database.ts +182 -0
- package/core/server/plugins/logger.ts +47 -0
- package/core/server/plugins/swagger.ts +34 -0
- package/core/server/standalone.ts +91 -0
- package/core/templates/create-project.ts +455 -0
- package/core/types/api.ts +169 -0
- package/core/types/build.ts +174 -0
- package/core/types/config.ts +68 -0
- package/core/types/index.ts +127 -0
- package/core/types/plugin.ts +94 -0
- package/core/utils/__tests__/errors.test.ts +139 -0
- package/core/utils/__tests__/helpers.test.ts +297 -0
- package/core/utils/__tests__/logger.test.ts +141 -0
- package/core/utils/env-runtime-v2.ts +232 -0
- package/core/utils/env-runtime.ts +252 -0
- package/core/utils/errors/codes.ts +115 -0
- package/core/utils/errors/handlers.ts +63 -0
- package/core/utils/errors/index.ts +81 -0
- package/core/utils/helpers.ts +180 -0
- package/core/utils/index.ts +18 -0
- package/core/utils/logger/index.ts +161 -0
- package/core/utils/logger.ts +106 -0
- package/core/utils/monitoring/index.ts +212 -0
- package/create-fluxstack.ts +1 -1
- package/create-test-app.ts +156 -0
- package/docker-compose.microservices.yml +75 -0
- package/docker-compose.simple.yml +57 -0
- package/docker-compose.yml +71 -0
- package/docs/dynamic-environment-variables.md +380 -0
- package/eslint.config.js +23 -0
- package/examples/dynamic-env-usage.ts +283 -0
- package/examples/hybrid-env-strategy.ts +212 -0
- package/examples/simplified-env-usage.ts +251 -0
- package/flux-cli.ts +214 -0
- package/fluxstack.config.ts +318 -0
- package/meu-app-teste/README.md +44 -0
- package/meu-app-teste/app/client/README.md +69 -0
- package/meu-app-teste/app/client/frontend-only.ts +12 -0
- package/meu-app-teste/app/client/index.html +13 -0
- package/meu-app-teste/app/client/public/vite.svg +1 -0
- package/meu-app-teste/app/client/src/App.css +883 -0
- package/meu-app-teste/app/client/src/App.tsx +669 -0
- package/meu-app-teste/app/client/src/assets/react.svg +1 -0
- package/meu-app-teste/app/client/src/components/TestPage.tsx +453 -0
- package/meu-app-teste/app/client/src/index.css +51 -0
- package/meu-app-teste/app/client/src/lib/eden-api.ts +110 -0
- package/meu-app-teste/app/client/src/main.tsx +10 -0
- package/meu-app-teste/app/client/src/vite-env.d.ts +1 -0
- package/meu-app-teste/app/client/tsconfig.app.json +43 -0
- package/meu-app-teste/app/client/tsconfig.json +7 -0
- package/meu-app-teste/app/client/tsconfig.node.json +25 -0
- package/meu-app-teste/app/server/app.ts +10 -0
- package/meu-app-teste/app/server/backend-only.ts +15 -0
- package/meu-app-teste/app/server/controllers/users.controller.ts +69 -0
- package/meu-app-teste/app/server/index.ts +104 -0
- package/meu-app-teste/app/server/routes/index.ts +25 -0
- package/meu-app-teste/app/server/routes/users.routes.ts +121 -0
- package/meu-app-teste/app/server/types/index.ts +1 -0
- package/meu-app-teste/app/shared/types/index.ts +18 -0
- package/meu-app-teste/bun.lock +1053 -0
- package/meu-app-teste/core/__tests__/integration.test.ts +227 -0
- package/meu-app-teste/core/build/index.ts +186 -0
- package/meu-app-teste/core/cli/command-registry.ts +334 -0
- package/meu-app-teste/core/cli/index.ts +394 -0
- package/meu-app-teste/core/cli/plugin-discovery.ts +200 -0
- package/meu-app-teste/core/client/standalone.ts +57 -0
- package/meu-app-teste/core/config/__tests__/config-loader.test.ts +591 -0
- package/meu-app-teste/core/config/__tests__/config-merger.test.ts +657 -0
- package/meu-app-teste/core/config/__tests__/env-converter.test.ts +372 -0
- package/meu-app-teste/core/config/__tests__/env-processor.test.ts +431 -0
- package/meu-app-teste/core/config/__tests__/env.test.ts +452 -0
- package/meu-app-teste/core/config/__tests__/integration.test.ts +418 -0
- package/meu-app-teste/core/config/__tests__/loader.test.ts +331 -0
- package/meu-app-teste/core/config/__tests__/schema.test.ts +129 -0
- package/meu-app-teste/core/config/__tests__/validator.test.ts +318 -0
- package/meu-app-teste/core/config/env-dynamic.ts +326 -0
- package/meu-app-teste/core/config/env.ts +597 -0
- package/meu-app-teste/core/config/index.ts +317 -0
- package/meu-app-teste/core/config/loader.ts +546 -0
- package/meu-app-teste/core/config/runtime-config.ts +322 -0
- package/meu-app-teste/core/config/schema.ts +694 -0
- package/meu-app-teste/core/config/validator.ts +540 -0
- package/meu-app-teste/core/framework/__tests__/server.test.ts +233 -0
- package/meu-app-teste/core/framework/client.ts +132 -0
- package/meu-app-teste/core/framework/index.ts +8 -0
- package/meu-app-teste/core/framework/server.ts +501 -0
- package/meu-app-teste/core/framework/types.ts +63 -0
- package/meu-app-teste/core/plugins/__tests__/built-in.test.ts.disabled +366 -0
- package/meu-app-teste/core/plugins/__tests__/manager.test.ts +398 -0
- package/meu-app-teste/core/plugins/__tests__/monitoring.test.ts +401 -0
- package/meu-app-teste/core/plugins/__tests__/registry.test.ts +335 -0
- package/meu-app-teste/core/plugins/built-in/index.ts +142 -0
- package/meu-app-teste/core/plugins/built-in/logger/index.ts +180 -0
- package/meu-app-teste/core/plugins/built-in/monitoring/README.md +193 -0
- package/meu-app-teste/core/plugins/built-in/monitoring/index.ts +912 -0
- package/meu-app-teste/core/plugins/built-in/static/index.ts +289 -0
- package/meu-app-teste/core/plugins/built-in/swagger/index.ts +229 -0
- package/meu-app-teste/core/plugins/built-in/vite/index.ts +316 -0
- package/meu-app-teste/core/plugins/config.ts +348 -0
- package/meu-app-teste/core/plugins/discovery.ts +350 -0
- package/meu-app-teste/core/plugins/executor.ts +351 -0
- package/meu-app-teste/core/plugins/index.ts +195 -0
- package/meu-app-teste/core/plugins/manager.ts +583 -0
- package/meu-app-teste/core/plugins/registry.ts +424 -0
- package/meu-app-teste/core/plugins/types.ts +254 -0
- package/meu-app-teste/core/server/framework.ts +123 -0
- package/meu-app-teste/core/server/index.ts +8 -0
- package/meu-app-teste/core/server/plugins/database.ts +182 -0
- package/meu-app-teste/core/server/plugins/logger.ts +47 -0
- package/meu-app-teste/core/server/plugins/swagger.ts +34 -0
- package/meu-app-teste/core/server/standalone.ts +91 -0
- package/meu-app-teste/core/templates/create-project.ts +455 -0
- package/meu-app-teste/core/types/api.ts +169 -0
- package/meu-app-teste/core/types/build.ts +174 -0
- package/meu-app-teste/core/types/config.ts +68 -0
- package/meu-app-teste/core/types/index.ts +127 -0
- package/meu-app-teste/core/types/plugin.ts +94 -0
- package/meu-app-teste/core/utils/__tests__/errors.test.ts +139 -0
- package/meu-app-teste/core/utils/__tests__/helpers.test.ts +297 -0
- package/meu-app-teste/core/utils/__tests__/logger.test.ts +141 -0
- package/meu-app-teste/core/utils/env-runtime-v2.ts +232 -0
- package/meu-app-teste/core/utils/env-runtime.ts +252 -0
- package/meu-app-teste/core/utils/errors/codes.ts +115 -0
- package/meu-app-teste/core/utils/errors/handlers.ts +63 -0
- package/meu-app-teste/core/utils/errors/index.ts +81 -0
- package/meu-app-teste/core/utils/helpers.ts +180 -0
- package/meu-app-teste/core/utils/index.ts +18 -0
- package/meu-app-teste/core/utils/logger/index.ts +161 -0
- package/meu-app-teste/core/utils/logger.ts +106 -0
- package/meu-app-teste/core/utils/monitoring/index.ts +212 -0
- package/meu-app-teste/package.json +92 -0
- package/meu-app-teste/tsconfig.json +51 -0
- package/meu-app-teste/vite.config.ts +42 -0
- package/my-final-test/README.md +44 -0
- package/my-final-test/app/client/README.md +69 -0
- package/my-final-test/app/client/frontend-only.ts +12 -0
- package/my-final-test/app/client/index.html +13 -0
- package/my-final-test/app/client/public/vite.svg +1 -0
- package/my-final-test/app/client/src/App.css +883 -0
- package/my-final-test/app/client/src/App.tsx +669 -0
- package/my-final-test/app/client/src/assets/react.svg +1 -0
- package/my-final-test/app/client/src/components/TestPage.tsx +453 -0
- package/my-final-test/app/client/src/index.css +51 -0
- package/my-final-test/app/client/src/lib/eden-api.ts +110 -0
- package/my-final-test/app/client/src/main.tsx +10 -0
- package/my-final-test/app/client/src/vite-env.d.ts +1 -0
- package/my-final-test/app/client/tsconfig.app.json +43 -0
- package/my-final-test/app/client/tsconfig.json +7 -0
- package/my-final-test/app/client/tsconfig.node.json +25 -0
- package/my-final-test/app/server/app.ts +10 -0
- package/my-final-test/app/server/backend-only.ts +15 -0
- package/my-final-test/app/server/controllers/users.controller.ts +69 -0
- package/my-final-test/app/server/index.ts +104 -0
- package/my-final-test/app/server/routes/index.ts +25 -0
- package/my-final-test/app/server/routes/users.routes.ts +121 -0
- package/my-final-test/app/server/types/index.ts +1 -0
- package/my-final-test/app/shared/types/index.ts +18 -0
- package/my-final-test/bun.lock +993 -0
- package/my-final-test/core/__tests__/integration.test.ts +227 -0
- package/my-final-test/core/build/index.ts +186 -0
- package/my-final-test/core/cli/command-registry.ts +334 -0
- package/my-final-test/core/cli/index.ts +394 -0
- package/my-final-test/core/cli/plugin-discovery.ts +200 -0
- package/my-final-test/core/client/standalone.ts +57 -0
- package/my-final-test/core/config/__tests__/config-loader.test.ts +591 -0
- package/my-final-test/core/config/__tests__/config-merger.test.ts +657 -0
- package/my-final-test/core/config/__tests__/env-converter.test.ts +372 -0
- package/my-final-test/core/config/__tests__/env-processor.test.ts +431 -0
- package/my-final-test/core/config/__tests__/env.test.ts +452 -0
- package/my-final-test/core/config/__tests__/integration.test.ts +418 -0
- package/my-final-test/core/config/__tests__/loader.test.ts +331 -0
- package/my-final-test/core/config/__tests__/schema.test.ts +129 -0
- package/my-final-test/core/config/__tests__/validator.test.ts +318 -0
- package/my-final-test/core/config/env-dynamic.ts +326 -0
- package/my-final-test/core/config/env.ts +597 -0
- package/my-final-test/core/config/index.ts +317 -0
- package/my-final-test/core/config/loader.ts +546 -0
- package/my-final-test/core/config/runtime-config.ts +322 -0
- package/my-final-test/core/config/schema.ts +694 -0
- package/my-final-test/core/config/validator.ts +540 -0
- package/my-final-test/core/framework/__tests__/server.test.ts +233 -0
- package/my-final-test/core/framework/client.ts +132 -0
- package/my-final-test/core/framework/index.ts +8 -0
- package/my-final-test/core/framework/server.ts +501 -0
- package/my-final-test/core/framework/types.ts +63 -0
- package/my-final-test/core/plugins/__tests__/built-in.test.ts.disabled +366 -0
- package/my-final-test/core/plugins/__tests__/manager.test.ts +398 -0
- package/my-final-test/core/plugins/__tests__/monitoring.test.ts +401 -0
- package/my-final-test/core/plugins/__tests__/registry.test.ts +335 -0
- package/my-final-test/core/plugins/built-in/index.ts +142 -0
- package/my-final-test/core/plugins/built-in/logger/index.ts +180 -0
- package/my-final-test/core/plugins/built-in/monitoring/README.md +193 -0
- package/my-final-test/core/plugins/built-in/monitoring/index.ts +912 -0
- package/my-final-test/core/plugins/built-in/static/index.ts +289 -0
- package/my-final-test/core/plugins/built-in/swagger/index.ts +229 -0
- package/my-final-test/core/plugins/built-in/vite/index.ts +316 -0
- package/my-final-test/core/plugins/config.ts +348 -0
- package/my-final-test/core/plugins/discovery.ts +350 -0
- package/my-final-test/core/plugins/executor.ts +351 -0
- package/my-final-test/core/plugins/index.ts +195 -0
- package/my-final-test/core/plugins/manager.ts +583 -0
- package/my-final-test/core/plugins/registry.ts +424 -0
- package/my-final-test/core/plugins/types.ts +254 -0
- package/my-final-test/core/server/framework.ts +123 -0
- package/my-final-test/core/server/index.ts +8 -0
- package/my-final-test/core/server/plugins/database.ts +182 -0
- package/my-final-test/core/server/plugins/logger.ts +47 -0
- package/my-final-test/core/server/plugins/swagger.ts +34 -0
- package/my-final-test/core/server/standalone.ts +91 -0
- package/my-final-test/core/templates/create-project.ts +455 -0
- package/my-final-test/core/types/api.ts +169 -0
- package/my-final-test/core/types/build.ts +174 -0
- package/my-final-test/core/types/config.ts +68 -0
- package/my-final-test/core/types/index.ts +127 -0
- package/my-final-test/core/types/plugin.ts +94 -0
- package/my-final-test/core/utils/__tests__/errors.test.ts +139 -0
- package/my-final-test/core/utils/__tests__/helpers.test.ts +297 -0
- package/my-final-test/core/utils/__tests__/logger.test.ts +141 -0
- package/my-final-test/core/utils/env-runtime-v2.ts +232 -0
- package/my-final-test/core/utils/env-runtime.ts +252 -0
- package/my-final-test/core/utils/errors/codes.ts +115 -0
- package/my-final-test/core/utils/errors/handlers.ts +63 -0
- package/my-final-test/core/utils/errors/index.ts +81 -0
- package/my-final-test/core/utils/helpers.ts +180 -0
- package/my-final-test/core/utils/index.ts +18 -0
- package/my-final-test/core/utils/logger/index.ts +161 -0
- package/my-final-test/core/utils/logger.ts +106 -0
- package/my-final-test/core/utils/monitoring/index.ts +212 -0
- package/my-final-test/package.json +68 -0
- package/my-final-test/tsconfig.json +51 -0
- package/my-final-test/vite.config.ts +42 -0
- package/nginx-lb.conf +37 -0
- package/package-template.json +32 -15
- package/package.json +71 -30
- package/publish-setup.md +111 -0
- package/publish.sh +63 -0
- package/run-clean.ts +26 -0
- package/run-env-tests.ts +313 -0
- package/tailwind.config.js +34 -0
- package/teste-corrigido/README.md +44 -0
- package/teste-corrigido/app/client/README.md +69 -0
- package/teste-corrigido/app/client/frontend-only.ts +12 -0
- package/teste-corrigido/app/client/index.html +13 -0
- package/teste-corrigido/app/client/public/vite.svg +1 -0
- package/teste-corrigido/app/client/src/App.css +883 -0
- package/teste-corrigido/app/client/src/App.tsx +669 -0
- package/teste-corrigido/app/client/src/assets/react.svg +1 -0
- package/teste-corrigido/app/client/src/components/TestPage.tsx +453 -0
- package/teste-corrigido/app/client/src/index.css +51 -0
- package/teste-corrigido/app/client/src/lib/eden-api.ts +110 -0
- package/teste-corrigido/app/client/src/main.tsx +10 -0
- package/teste-corrigido/app/client/src/vite-env.d.ts +1 -0
- package/teste-corrigido/app/client/tsconfig.app.json +43 -0
- package/teste-corrigido/app/client/tsconfig.json +7 -0
- package/teste-corrigido/app/client/tsconfig.node.json +25 -0
- package/teste-corrigido/app/server/app.ts +10 -0
- package/teste-corrigido/app/server/backend-only.ts +15 -0
- package/teste-corrigido/app/server/controllers/users.controller.ts +69 -0
- package/teste-corrigido/app/server/index.ts +104 -0
- package/teste-corrigido/app/server/routes/index.ts +25 -0
- package/teste-corrigido/app/server/routes/users.routes.ts +121 -0
- package/teste-corrigido/app/server/types/index.ts +1 -0
- package/teste-corrigido/app/shared/types/index.ts +18 -0
- package/teste-corrigido/bun.lock +1053 -0
- package/teste-corrigido/core/__tests__/integration.test.ts +227 -0
- package/teste-corrigido/core/build/index.ts +186 -0
- package/teste-corrigido/core/cli/command-registry.ts +334 -0
- package/teste-corrigido/core/cli/index.ts +394 -0
- package/teste-corrigido/core/cli/plugin-discovery.ts +200 -0
- package/teste-corrigido/core/client/standalone.ts +57 -0
- package/teste-corrigido/core/config/__tests__/config-loader.test.ts +591 -0
- package/teste-corrigido/core/config/__tests__/config-merger.test.ts +657 -0
- package/teste-corrigido/core/config/__tests__/env-converter.test.ts +372 -0
- package/teste-corrigido/core/config/__tests__/env-processor.test.ts +431 -0
- package/teste-corrigido/core/config/__tests__/env.test.ts +452 -0
- package/teste-corrigido/core/config/__tests__/integration.test.ts +418 -0
- package/teste-corrigido/core/config/__tests__/loader.test.ts +331 -0
- package/teste-corrigido/core/config/__tests__/schema.test.ts +129 -0
- package/teste-corrigido/core/config/__tests__/validator.test.ts +318 -0
- package/teste-corrigido/core/config/env-dynamic.ts +326 -0
- package/teste-corrigido/core/config/env.ts +597 -0
- package/teste-corrigido/core/config/index.ts +317 -0
- package/teste-corrigido/core/config/loader.ts +546 -0
- package/teste-corrigido/core/config/runtime-config.ts +322 -0
- package/teste-corrigido/core/config/schema.ts +694 -0
- package/teste-corrigido/core/config/validator.ts +540 -0
- package/teste-corrigido/core/framework/__tests__/server.test.ts +233 -0
- package/teste-corrigido/core/framework/client.ts +132 -0
- package/teste-corrigido/core/framework/index.ts +8 -0
- package/teste-corrigido/core/framework/server.ts +501 -0
- package/teste-corrigido/core/framework/types.ts +63 -0
- package/teste-corrigido/core/plugins/__tests__/built-in.test.ts.disabled +366 -0
- package/teste-corrigido/core/plugins/__tests__/manager.test.ts +398 -0
- package/teste-corrigido/core/plugins/__tests__/monitoring.test.ts +401 -0
- package/teste-corrigido/core/plugins/__tests__/registry.test.ts +335 -0
- package/teste-corrigido/core/plugins/built-in/index.ts +142 -0
- package/teste-corrigido/core/plugins/built-in/logger/index.ts +180 -0
- package/teste-corrigido/core/plugins/built-in/monitoring/README.md +193 -0
- package/teste-corrigido/core/plugins/built-in/monitoring/index.ts +912 -0
- package/teste-corrigido/core/plugins/built-in/static/index.ts +289 -0
- package/teste-corrigido/core/plugins/built-in/swagger/index.ts +229 -0
- package/teste-corrigido/core/plugins/built-in/vite/index.ts +316 -0
- package/teste-corrigido/core/plugins/config.ts +348 -0
- package/teste-corrigido/core/plugins/discovery.ts +350 -0
- package/teste-corrigido/core/plugins/executor.ts +351 -0
- package/teste-corrigido/core/plugins/index.ts +195 -0
- package/teste-corrigido/core/plugins/manager.ts +583 -0
- package/teste-corrigido/core/plugins/registry.ts +424 -0
- package/teste-corrigido/core/plugins/types.ts +254 -0
- package/teste-corrigido/core/server/framework.ts +123 -0
- package/teste-corrigido/core/server/index.ts +8 -0
- package/teste-corrigido/core/server/plugins/database.ts +182 -0
- package/teste-corrigido/core/server/plugins/logger.ts +47 -0
- package/teste-corrigido/core/server/plugins/swagger.ts +34 -0
- package/teste-corrigido/core/server/standalone.ts +91 -0
- package/teste-corrigido/core/templates/create-project.ts +455 -0
- package/teste-corrigido/core/types/api.ts +169 -0
- package/teste-corrigido/core/types/build.ts +174 -0
- package/teste-corrigido/core/types/config.ts +68 -0
- package/teste-corrigido/core/types/index.ts +127 -0
- package/teste-corrigido/core/types/plugin.ts +94 -0
- package/teste-corrigido/core/utils/__tests__/errors.test.ts +139 -0
- package/teste-corrigido/core/utils/__tests__/helpers.test.ts +297 -0
- package/teste-corrigido/core/utils/__tests__/logger.test.ts +141 -0
- package/teste-corrigido/core/utils/env-runtime-v2.ts +232 -0
- package/teste-corrigido/core/utils/env-runtime.ts +252 -0
- package/teste-corrigido/core/utils/errors/codes.ts +115 -0
- package/teste-corrigido/core/utils/errors/handlers.ts +63 -0
- package/teste-corrigido/core/utils/errors/index.ts +81 -0
- package/teste-corrigido/core/utils/helpers.ts +180 -0
- package/teste-corrigido/core/utils/index.ts +18 -0
- package/teste-corrigido/core/utils/logger/index.ts +161 -0
- package/teste-corrigido/core/utils/logger.ts +106 -0
- package/teste-corrigido/core/utils/monitoring/index.ts +212 -0
- package/teste-corrigido/package-template.json +51 -0
- package/teste-corrigido/package.json +51 -0
- package/teste-corrigido/tsconfig.json +51 -0
- package/teste-corrigido/vite.config.ts +42 -0
- package/teste-final-npm/README.md +44 -0
- package/teste-final-npm/app/client/README.md +69 -0
- package/teste-final-npm/app/client/frontend-only.ts +12 -0
- package/teste-final-npm/app/client/index.html +13 -0
- package/teste-final-npm/app/client/public/vite.svg +1 -0
- package/teste-final-npm/app/client/src/App.css +883 -0
- package/teste-final-npm/app/client/src/App.tsx +669 -0
- package/teste-final-npm/app/client/src/assets/react.svg +1 -0
- package/teste-final-npm/app/client/src/components/TestPage.tsx +453 -0
- package/teste-final-npm/app/client/src/index.css +51 -0
- package/teste-final-npm/app/client/src/lib/eden-api.ts +110 -0
- package/teste-final-npm/app/client/src/main.tsx +10 -0
- package/teste-final-npm/app/client/src/vite-env.d.ts +1 -0
- package/teste-final-npm/app/client/tsconfig.app.json +43 -0
- package/teste-final-npm/app/client/tsconfig.json +7 -0
- package/teste-final-npm/app/client/tsconfig.node.json +25 -0
- package/teste-final-npm/app/server/app.ts +10 -0
- package/teste-final-npm/app/server/backend-only.ts +15 -0
- package/teste-final-npm/app/server/controllers/users.controller.ts +69 -0
- package/teste-final-npm/app/server/index.ts +104 -0
- package/teste-final-npm/app/server/routes/index.ts +25 -0
- package/teste-final-npm/app/server/routes/users.routes.ts +121 -0
- package/teste-final-npm/app/server/types/index.ts +1 -0
- package/teste-final-npm/app/shared/types/index.ts +18 -0
- package/teste-final-npm/bun.lock +1053 -0
- package/teste-final-npm/core/__tests__/integration.test.ts +227 -0
- package/teste-final-npm/core/build/index.ts +186 -0
- package/teste-final-npm/core/cli/command-registry.ts +334 -0
- package/teste-final-npm/core/cli/index.ts +394 -0
- package/teste-final-npm/core/cli/plugin-discovery.ts +200 -0
- package/teste-final-npm/core/client/standalone.ts +57 -0
- package/teste-final-npm/core/config/__tests__/config-loader.test.ts +591 -0
- package/teste-final-npm/core/config/__tests__/config-merger.test.ts +657 -0
- package/teste-final-npm/core/config/__tests__/env-converter.test.ts +372 -0
- package/teste-final-npm/core/config/__tests__/env-processor.test.ts +431 -0
- package/teste-final-npm/core/config/__tests__/env.test.ts +452 -0
- package/teste-final-npm/core/config/__tests__/integration.test.ts +418 -0
- package/teste-final-npm/core/config/__tests__/loader.test.ts +331 -0
- package/teste-final-npm/core/config/__tests__/schema.test.ts +129 -0
- package/teste-final-npm/core/config/__tests__/validator.test.ts +318 -0
- package/teste-final-npm/core/config/env-dynamic.ts +326 -0
- package/teste-final-npm/core/config/env.ts +597 -0
- package/teste-final-npm/core/config/index.ts +317 -0
- package/teste-final-npm/core/config/loader.ts +546 -0
- package/teste-final-npm/core/config/runtime-config.ts +322 -0
- package/teste-final-npm/core/config/schema.ts +694 -0
- package/teste-final-npm/core/config/validator.ts +540 -0
- package/teste-final-npm/core/framework/__tests__/server.test.ts +233 -0
- package/teste-final-npm/core/framework/client.ts +132 -0
- package/teste-final-npm/core/framework/index.ts +8 -0
- package/teste-final-npm/core/framework/server.ts +501 -0
- package/teste-final-npm/core/framework/types.ts +63 -0
- package/teste-final-npm/core/plugins/__tests__/built-in.test.ts.disabled +366 -0
- package/teste-final-npm/core/plugins/__tests__/manager.test.ts +398 -0
- package/teste-final-npm/core/plugins/__tests__/monitoring.test.ts +401 -0
- package/teste-final-npm/core/plugins/__tests__/registry.test.ts +335 -0
- package/teste-final-npm/core/plugins/built-in/index.ts +142 -0
- package/teste-final-npm/core/plugins/built-in/logger/index.ts +180 -0
- package/teste-final-npm/core/plugins/built-in/monitoring/README.md +193 -0
- package/teste-final-npm/core/plugins/built-in/monitoring/index.ts +912 -0
- package/teste-final-npm/core/plugins/built-in/static/index.ts +289 -0
- package/teste-final-npm/core/plugins/built-in/swagger/index.ts +229 -0
- package/teste-final-npm/core/plugins/built-in/vite/index.ts +316 -0
- package/teste-final-npm/core/plugins/config.ts +348 -0
- package/teste-final-npm/core/plugins/discovery.ts +350 -0
- package/teste-final-npm/core/plugins/executor.ts +351 -0
- package/teste-final-npm/core/plugins/index.ts +195 -0
- package/teste-final-npm/core/plugins/manager.ts +583 -0
- package/teste-final-npm/core/plugins/registry.ts +424 -0
- package/teste-final-npm/core/plugins/types.ts +254 -0
- package/teste-final-npm/core/server/framework.ts +123 -0
- package/teste-final-npm/core/server/index.ts +8 -0
- package/teste-final-npm/core/server/plugins/database.ts +182 -0
- package/teste-final-npm/core/server/plugins/logger.ts +47 -0
- package/teste-final-npm/core/server/plugins/swagger.ts +34 -0
- package/teste-final-npm/core/server/standalone.ts +91 -0
- package/teste-final-npm/core/templates/create-project.ts +455 -0
- package/teste-final-npm/core/types/api.ts +169 -0
- package/teste-final-npm/core/types/build.ts +174 -0
- package/teste-final-npm/core/types/config.ts +68 -0
- package/teste-final-npm/core/types/index.ts +127 -0
- package/teste-final-npm/core/types/plugin.ts +94 -0
- package/teste-final-npm/core/utils/__tests__/errors.test.ts +139 -0
- package/teste-final-npm/core/utils/__tests__/helpers.test.ts +297 -0
- package/teste-final-npm/core/utils/__tests__/logger.test.ts +141 -0
- package/teste-final-npm/core/utils/env-runtime-v2.ts +232 -0
- package/teste-final-npm/core/utils/env-runtime.ts +252 -0
- package/teste-final-npm/core/utils/errors/codes.ts +115 -0
- package/teste-final-npm/core/utils/errors/handlers.ts +63 -0
- package/teste-final-npm/core/utils/errors/index.ts +81 -0
- package/teste-final-npm/core/utils/helpers.ts +180 -0
- package/teste-final-npm/core/utils/index.ts +18 -0
- package/teste-final-npm/core/utils/logger/index.ts +161 -0
- package/teste-final-npm/core/utils/logger.ts +106 -0
- package/teste-final-npm/core/utils/monitoring/index.ts +212 -0
- package/teste-final-npm/package-template.json +51 -0
- package/teste-final-npm/package.json +51 -0
- package/teste-final-npm/tsconfig.json +51 -0
- package/teste-final-npm/vite.config.ts +42 -0
- package/tests/__mocks__/api.ts +56 -0
- package/tests/fixtures/users.ts +69 -0
- package/tests/integration/api/users.routes.test.ts +221 -0
- package/tests/setup.ts +29 -0
- package/tests/unit/app/client/App-simple.test.tsx +56 -0
- package/tests/unit/app/client/App.test.tsx.skip +237 -0
- package/tests/unit/app/client/eden-api.test.ts +186 -0
- package/tests/unit/app/client/simple.test.tsx +23 -0
- package/tests/unit/app/controllers/users.controller.test.ts +150 -0
- package/tests/unit/core/create-project.test.ts.skip +95 -0
- package/tests/unit/core/framework.test.ts +144 -0
- package/tests/unit/core/plugins/logger.test.ts.skip +268 -0
- package/tests/unit/core/plugins/vite.test.ts.disabled +188 -0
- package/tests/utils/test-helpers.ts +61 -0
- package/tsconfig.json +51 -0
- package/types/global.d.ts +30 -0
- package/types/vitest.d.ts +9 -0
- package/vite.config.ts +42 -0
- package/vitest.config.ts +50 -0
- package/workspace.json +6 -0
|
@@ -0,0 +1,591 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tests for Configuration Loader
|
|
3
|
+
* Tests the main configuration loading system, including file loading, caching, and fallbacks
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import { describe, test, expect, beforeEach, afterEach, vi } from 'vitest'
|
|
7
|
+
import {
|
|
8
|
+
getConfig,
|
|
9
|
+
getConfigSync,
|
|
10
|
+
reloadConfig,
|
|
11
|
+
createPluginConfig,
|
|
12
|
+
isFeatureEnabled,
|
|
13
|
+
createLegacyConfig
|
|
14
|
+
} from '../index'
|
|
15
|
+
import type { FluxStackConfig } from '../schema'
|
|
16
|
+
|
|
17
|
+
// Mock file system operations
|
|
18
|
+
vi.mock('fs', () => ({
|
|
19
|
+
existsSync: vi.fn(),
|
|
20
|
+
promises: {
|
|
21
|
+
readFile: vi.fn(),
|
|
22
|
+
access: vi.fn()
|
|
23
|
+
}
|
|
24
|
+
}))
|
|
25
|
+
|
|
26
|
+
vi.mock('fs/promises', () => ({
|
|
27
|
+
readFile: vi.fn(),
|
|
28
|
+
access: vi.fn()
|
|
29
|
+
}))
|
|
30
|
+
|
|
31
|
+
describe('Configuration Loader', () => {
|
|
32
|
+
let originalEnv: NodeJS.ProcessEnv
|
|
33
|
+
|
|
34
|
+
beforeEach(() => {
|
|
35
|
+
originalEnv = { ...process.env }
|
|
36
|
+
// Clear relevant environment variables
|
|
37
|
+
for (const key in process.env) {
|
|
38
|
+
if (key.startsWith('FLUXSTACK_') || key.startsWith('PORT') || key.startsWith('HOST') ||
|
|
39
|
+
key.startsWith('NODE_ENV')) {
|
|
40
|
+
delete process.env[key]
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
// Clear any cached configurations
|
|
45
|
+
vi.clearAllMocks()
|
|
46
|
+
})
|
|
47
|
+
|
|
48
|
+
afterEach(() => {
|
|
49
|
+
process.env = originalEnv
|
|
50
|
+
})
|
|
51
|
+
|
|
52
|
+
describe('getConfigSync', () => {
|
|
53
|
+
test('loads configuration from environment variables', () => {
|
|
54
|
+
process.env.PORT = '4000'
|
|
55
|
+
process.env.HOST = 'example.com'
|
|
56
|
+
process.env.LOG_LEVEL = 'debug'
|
|
57
|
+
process.env.NODE_ENV = 'production'
|
|
58
|
+
|
|
59
|
+
const config = getConfigSync()
|
|
60
|
+
|
|
61
|
+
expect(config.server?.port).toBe(4000)
|
|
62
|
+
expect(config.server?.host).toBe('example.com')
|
|
63
|
+
expect(config.logging?.level).toBe('debug')
|
|
64
|
+
})
|
|
65
|
+
|
|
66
|
+
test('applies environment defaults based on NODE_ENV', () => {
|
|
67
|
+
process.env.NODE_ENV = 'production'
|
|
68
|
+
|
|
69
|
+
const config = getConfigSync()
|
|
70
|
+
|
|
71
|
+
// Should apply production defaults
|
|
72
|
+
expect(config.build?.optimization?.minify).toBe(true)
|
|
73
|
+
expect(config.monitoring?.enabled).toBe(true)
|
|
74
|
+
})
|
|
75
|
+
|
|
76
|
+
test('uses development defaults when NODE_ENV not set', () => {
|
|
77
|
+
delete process.env.NODE_ENV
|
|
78
|
+
|
|
79
|
+
const config = getConfigSync()
|
|
80
|
+
|
|
81
|
+
// Should apply development defaults
|
|
82
|
+
expect(config.build?.optimization?.minify).toBe(false)
|
|
83
|
+
expect(config.monitoring?.enabled).toBe(false)
|
|
84
|
+
})
|
|
85
|
+
|
|
86
|
+
test('handles custom environment variables with FluxStack prefix', () => {
|
|
87
|
+
process.env.FLUXSTACK_PORT = '5000'
|
|
88
|
+
process.env.FLUXSTACK_API_PREFIX = '/v2'
|
|
89
|
+
process.env.FLUXSTACK_LOG_LEVEL = 'error'
|
|
90
|
+
|
|
91
|
+
// Force reload config to pick up new env vars
|
|
92
|
+
reloadConfig()
|
|
93
|
+
const config = getConfigSync()
|
|
94
|
+
|
|
95
|
+
expect(config.server?.port).toBe(5000)
|
|
96
|
+
expect(config.server?.apiPrefix).toBe('/v2')
|
|
97
|
+
expect(config.logging?.level).toBe('error')
|
|
98
|
+
})
|
|
99
|
+
|
|
100
|
+
test('merges CORS configuration from environment', () => {
|
|
101
|
+
process.env.CORS_ORIGINS = 'http://localhost:3000,https://example.com'
|
|
102
|
+
process.env.CORS_METHODS = 'GET,POST,DELETE'
|
|
103
|
+
process.env.CORS_CREDENTIALS = 'true'
|
|
104
|
+
|
|
105
|
+
const config = getConfigSync()
|
|
106
|
+
|
|
107
|
+
expect(config.server?.cors?.origins).toEqual(['http://localhost:3000', 'https://example.com'])
|
|
108
|
+
expect(config.server?.cors?.methods).toEqual(['GET', 'POST', 'DELETE'])
|
|
109
|
+
expect(config.server?.cors?.credentials).toBe(true)
|
|
110
|
+
})
|
|
111
|
+
|
|
112
|
+
test('handles database configuration from environment', () => {
|
|
113
|
+
process.env.DATABASE_URL = 'postgresql://user:pass@localhost:5432/db'
|
|
114
|
+
process.env.DATABASE_HOST = 'db.example.com'
|
|
115
|
+
process.env.DATABASE_PORT = '5433'
|
|
116
|
+
process.env.DATABASE_SSL = 'true'
|
|
117
|
+
|
|
118
|
+
const config = getConfigSync()
|
|
119
|
+
|
|
120
|
+
expect(config.database?.url).toBe('postgresql://user:pass@localhost:5432/db')
|
|
121
|
+
expect(config.database?.host).toBe('db.example.com')
|
|
122
|
+
expect(config.database?.port).toBe(5433)
|
|
123
|
+
expect(config.database?.ssl).toBe(true)
|
|
124
|
+
})
|
|
125
|
+
|
|
126
|
+
test('handles authentication configuration', () => {
|
|
127
|
+
process.env.JWT_SECRET = 'my-secret-key'
|
|
128
|
+
process.env.JWT_EXPIRES_IN = '7d'
|
|
129
|
+
process.env.JWT_ALGORITHM = 'HS256'
|
|
130
|
+
|
|
131
|
+
const config = getConfigSync()
|
|
132
|
+
|
|
133
|
+
expect(config.auth?.secret).toBe('my-secret-key')
|
|
134
|
+
expect(config.auth?.expiresIn).toBe('7d')
|
|
135
|
+
expect(config.auth?.algorithm).toBe('HS256')
|
|
136
|
+
})
|
|
137
|
+
|
|
138
|
+
test('handles email configuration', () => {
|
|
139
|
+
process.env.SMTP_HOST = 'smtp.gmail.com'
|
|
140
|
+
process.env.SMTP_PORT = '587'
|
|
141
|
+
process.env.SMTP_USER = 'user@example.com'
|
|
142
|
+
process.env.SMTP_SECURE = 'true'
|
|
143
|
+
|
|
144
|
+
const config = getConfigSync()
|
|
145
|
+
|
|
146
|
+
expect(config.email?.host).toBe('smtp.gmail.com')
|
|
147
|
+
expect(config.email?.port).toBe(587)
|
|
148
|
+
expect(config.email?.user).toBe('user@example.com')
|
|
149
|
+
expect(config.email?.secure).toBe(true)
|
|
150
|
+
})
|
|
151
|
+
|
|
152
|
+
test('handles monitoring configuration', () => {
|
|
153
|
+
process.env.MONITORING_ENABLED = 'true'
|
|
154
|
+
process.env.METRICS_ENABLED = 'false'
|
|
155
|
+
process.env.METRICS_INTERVAL = '30000'
|
|
156
|
+
process.env.PROFILING_ENABLED = 'true'
|
|
157
|
+
|
|
158
|
+
const config = getConfigSync()
|
|
159
|
+
|
|
160
|
+
expect(config.monitoring?.enabled).toBe(true)
|
|
161
|
+
expect(config.monitoring?.metrics?.enabled).toBe(false)
|
|
162
|
+
expect(config.monitoring?.metrics?.collectInterval).toBe(30000)
|
|
163
|
+
expect(config.monitoring?.profiling?.enabled).toBe(true)
|
|
164
|
+
})
|
|
165
|
+
|
|
166
|
+
test('handles build configuration', () => {
|
|
167
|
+
process.env.BUILD_TARGET = 'docker'
|
|
168
|
+
process.env.BUILD_OUTDIR = 'build'
|
|
169
|
+
process.env.BUILD_MINIFY = 'true'
|
|
170
|
+
process.env.BUILD_SOURCEMAPS = 'false'
|
|
171
|
+
|
|
172
|
+
reloadConfig()
|
|
173
|
+
const config = getConfigSync()
|
|
174
|
+
|
|
175
|
+
expect(config.build?.target).toBe('docker')
|
|
176
|
+
expect(config.build?.outDir).toBe('build')
|
|
177
|
+
expect(config.build?.optimization?.minify).toBe(true)
|
|
178
|
+
expect(config.build?.sourceMaps).toBe(false)
|
|
179
|
+
})
|
|
180
|
+
|
|
181
|
+
test('handles plugin configuration', () => {
|
|
182
|
+
process.env.FLUXSTACK_PLUGINS_ENABLED = 'plugin1,plugin2,plugin3'
|
|
183
|
+
process.env.FLUXSTACK_PLUGINS_DISABLED = 'plugin4'
|
|
184
|
+
|
|
185
|
+
reloadConfig()
|
|
186
|
+
const config = getConfigSync()
|
|
187
|
+
|
|
188
|
+
expect(config.plugins?.enabled).toEqual(['plugin1', 'plugin2', 'plugin3'])
|
|
189
|
+
expect(config.plugins?.disabled).toEqual(['plugin4'])
|
|
190
|
+
})
|
|
191
|
+
})
|
|
192
|
+
|
|
193
|
+
describe('createPluginConfig', () => {
|
|
194
|
+
test('creates plugin configuration from main config', () => {
|
|
195
|
+
const mainConfig: FluxStackConfig = {
|
|
196
|
+
app: { name: 'TestApp', version: '1.0.0' },
|
|
197
|
+
server: {
|
|
198
|
+
port: 3000,
|
|
199
|
+
host: 'localhost',
|
|
200
|
+
apiPrefix: '/api',
|
|
201
|
+
cors: {
|
|
202
|
+
origins: ['*'],
|
|
203
|
+
methods: ['GET', 'POST'],
|
|
204
|
+
headers: ['Content-Type'],
|
|
205
|
+
credentials: false,
|
|
206
|
+
maxAge: 86400
|
|
207
|
+
},
|
|
208
|
+
middleware: []
|
|
209
|
+
},
|
|
210
|
+
client: {
|
|
211
|
+
port: 5173,
|
|
212
|
+
proxy: { target: 'http://localhost:3000' },
|
|
213
|
+
build: {
|
|
214
|
+
target: 'es2020',
|
|
215
|
+
outDir: 'dist/client',
|
|
216
|
+
sourceMaps: true,
|
|
217
|
+
minify: false
|
|
218
|
+
}
|
|
219
|
+
},
|
|
220
|
+
build: {
|
|
221
|
+
target: 'bun',
|
|
222
|
+
outDir: 'dist',
|
|
223
|
+
clean: true,
|
|
224
|
+
optimization: {
|
|
225
|
+
minify: false,
|
|
226
|
+
compress: false,
|
|
227
|
+
treeshake: false,
|
|
228
|
+
splitChunks: false,
|
|
229
|
+
bundleAnalyzer: false
|
|
230
|
+
},
|
|
231
|
+
sourceMaps: true
|
|
232
|
+
},
|
|
233
|
+
logging: {
|
|
234
|
+
level: 'info',
|
|
235
|
+
format: 'pretty',
|
|
236
|
+
transports: [
|
|
237
|
+
{ type: 'console', level: 'info', format: 'pretty' }
|
|
238
|
+
]
|
|
239
|
+
},
|
|
240
|
+
monitoring: {
|
|
241
|
+
enabled: false,
|
|
242
|
+
metrics: {
|
|
243
|
+
enabled: false,
|
|
244
|
+
collectInterval: 60000,
|
|
245
|
+
httpMetrics: true,
|
|
246
|
+
systemMetrics: true,
|
|
247
|
+
customMetrics: false
|
|
248
|
+
},
|
|
249
|
+
profiling: {
|
|
250
|
+
enabled: false,
|
|
251
|
+
sampleRate: 0.1,
|
|
252
|
+
memoryProfiling: false,
|
|
253
|
+
cpuProfiling: false
|
|
254
|
+
},
|
|
255
|
+
exporters: []
|
|
256
|
+
},
|
|
257
|
+
plugins: {
|
|
258
|
+
enabled: [],
|
|
259
|
+
disabled: [],
|
|
260
|
+
config: {
|
|
261
|
+
vite: {
|
|
262
|
+
port: 5174,
|
|
263
|
+
enabled: true
|
|
264
|
+
},
|
|
265
|
+
logger: {
|
|
266
|
+
logRequests: true,
|
|
267
|
+
logResponses: false
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
},
|
|
271
|
+
custom: {
|
|
272
|
+
myPlugin: {
|
|
273
|
+
customSetting: 'value'
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
} as FluxStackConfig
|
|
277
|
+
|
|
278
|
+
// Test plugin config from plugins.config
|
|
279
|
+
const viteConfig = createPluginConfig(mainConfig, 'vite')
|
|
280
|
+
expect(viteConfig).toEqual({
|
|
281
|
+
port: 5174,
|
|
282
|
+
enabled: true
|
|
283
|
+
})
|
|
284
|
+
|
|
285
|
+
// Test plugin config from custom section
|
|
286
|
+
const myPluginConfig = createPluginConfig(mainConfig, 'myPlugin')
|
|
287
|
+
expect(myPluginConfig).toEqual({
|
|
288
|
+
customSetting: 'value'
|
|
289
|
+
})
|
|
290
|
+
|
|
291
|
+
// Test merging both sections
|
|
292
|
+
const combinedConfig: FluxStackConfig = {
|
|
293
|
+
...mainConfig,
|
|
294
|
+
plugins: {
|
|
295
|
+
...mainConfig.plugins,
|
|
296
|
+
config: {
|
|
297
|
+
...mainConfig.plugins.config,
|
|
298
|
+
myPlugin: {
|
|
299
|
+
baseSetting: 'base'
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
const mergedConfig = createPluginConfig(combinedConfig, 'myPlugin')
|
|
306
|
+
expect(mergedConfig).toEqual({
|
|
307
|
+
baseSetting: 'base',
|
|
308
|
+
customSetting: 'value' // custom should override plugins.config
|
|
309
|
+
})
|
|
310
|
+
})
|
|
311
|
+
|
|
312
|
+
test('returns empty object for non-existent plugin', () => {
|
|
313
|
+
const mainConfig: FluxStackConfig = {
|
|
314
|
+
app: { name: 'TestApp', version: '1.0.0' },
|
|
315
|
+
server: {
|
|
316
|
+
port: 3000,
|
|
317
|
+
host: 'localhost',
|
|
318
|
+
apiPrefix: '/api',
|
|
319
|
+
cors: {
|
|
320
|
+
origins: ['*'],
|
|
321
|
+
methods: ['GET', 'POST'],
|
|
322
|
+
headers: ['Content-Type'],
|
|
323
|
+
credentials: false,
|
|
324
|
+
maxAge: 86400
|
|
325
|
+
},
|
|
326
|
+
middleware: []
|
|
327
|
+
},
|
|
328
|
+
client: {
|
|
329
|
+
port: 5173,
|
|
330
|
+
proxy: { target: 'http://localhost:3000' },
|
|
331
|
+
build: {
|
|
332
|
+
target: 'es2020',
|
|
333
|
+
outDir: 'dist/client',
|
|
334
|
+
sourceMaps: true,
|
|
335
|
+
minify: false
|
|
336
|
+
}
|
|
337
|
+
},
|
|
338
|
+
build: {
|
|
339
|
+
target: 'bun',
|
|
340
|
+
outDir: 'dist',
|
|
341
|
+
clean: true,
|
|
342
|
+
optimization: {
|
|
343
|
+
minify: false,
|
|
344
|
+
compress: false,
|
|
345
|
+
treeshake: false,
|
|
346
|
+
splitChunks: false,
|
|
347
|
+
bundleAnalyzer: false
|
|
348
|
+
},
|
|
349
|
+
sourceMaps: true
|
|
350
|
+
},
|
|
351
|
+
logging: {
|
|
352
|
+
level: 'info',
|
|
353
|
+
format: 'pretty',
|
|
354
|
+
transports: [
|
|
355
|
+
{ type: 'console', level: 'info', format: 'pretty' }
|
|
356
|
+
]
|
|
357
|
+
},
|
|
358
|
+
monitoring: {
|
|
359
|
+
enabled: false,
|
|
360
|
+
metrics: {
|
|
361
|
+
enabled: false,
|
|
362
|
+
collectInterval: 60000,
|
|
363
|
+
httpMetrics: true,
|
|
364
|
+
systemMetrics: true,
|
|
365
|
+
customMetrics: false
|
|
366
|
+
},
|
|
367
|
+
profiling: {
|
|
368
|
+
enabled: false,
|
|
369
|
+
sampleRate: 0.1,
|
|
370
|
+
memoryProfiling: false,
|
|
371
|
+
cpuProfiling: false
|
|
372
|
+
},
|
|
373
|
+
exporters: []
|
|
374
|
+
},
|
|
375
|
+
plugins: {
|
|
376
|
+
enabled: [],
|
|
377
|
+
disabled: [],
|
|
378
|
+
config: {}
|
|
379
|
+
}
|
|
380
|
+
} as FluxStackConfig
|
|
381
|
+
|
|
382
|
+
const config = createPluginConfig(mainConfig, 'nonexistent')
|
|
383
|
+
expect(config).toEqual({})
|
|
384
|
+
})
|
|
385
|
+
})
|
|
386
|
+
|
|
387
|
+
describe('isFeatureEnabled', () => {
|
|
388
|
+
test('checks if feature is enabled in plugins', () => {
|
|
389
|
+
const config: FluxStackConfig = {
|
|
390
|
+
app: { name: 'TestApp', version: '1.0.0' },
|
|
391
|
+
server: {
|
|
392
|
+
port: 3000,
|
|
393
|
+
host: 'localhost',
|
|
394
|
+
apiPrefix: '/api',
|
|
395
|
+
cors: {
|
|
396
|
+
origins: ['*'],
|
|
397
|
+
methods: ['GET', 'POST'],
|
|
398
|
+
headers: ['Content-Type'],
|
|
399
|
+
credentials: false,
|
|
400
|
+
maxAge: 86400
|
|
401
|
+
},
|
|
402
|
+
middleware: []
|
|
403
|
+
},
|
|
404
|
+
client: {
|
|
405
|
+
port: 5173,
|
|
406
|
+
proxy: { target: 'http://localhost:3000' },
|
|
407
|
+
build: {
|
|
408
|
+
target: 'es2020',
|
|
409
|
+
outDir: 'dist/client',
|
|
410
|
+
sourceMaps: true,
|
|
411
|
+
minify: false
|
|
412
|
+
}
|
|
413
|
+
},
|
|
414
|
+
build: {
|
|
415
|
+
target: 'bun',
|
|
416
|
+
outDir: 'dist',
|
|
417
|
+
clean: true,
|
|
418
|
+
optimization: {
|
|
419
|
+
minify: false,
|
|
420
|
+
compress: false,
|
|
421
|
+
treeshake: false,
|
|
422
|
+
splitChunks: false,
|
|
423
|
+
bundleAnalyzer: false
|
|
424
|
+
},
|
|
425
|
+
sourceMaps: true
|
|
426
|
+
},
|
|
427
|
+
logging: {
|
|
428
|
+
level: 'info',
|
|
429
|
+
format: 'pretty',
|
|
430
|
+
transports: [
|
|
431
|
+
{ type: 'console', level: 'info', format: 'pretty' }
|
|
432
|
+
]
|
|
433
|
+
},
|
|
434
|
+
monitoring: {
|
|
435
|
+
enabled: true,
|
|
436
|
+
metrics: {
|
|
437
|
+
enabled: true,
|
|
438
|
+
collectInterval: 60000,
|
|
439
|
+
httpMetrics: true,
|
|
440
|
+
systemMetrics: true,
|
|
441
|
+
customMetrics: false
|
|
442
|
+
},
|
|
443
|
+
profiling: {
|
|
444
|
+
enabled: false,
|
|
445
|
+
sampleRate: 0.1,
|
|
446
|
+
memoryProfiling: false,
|
|
447
|
+
cpuProfiling: false
|
|
448
|
+
},
|
|
449
|
+
exporters: []
|
|
450
|
+
},
|
|
451
|
+
plugins: {
|
|
452
|
+
enabled: ['plugin1', 'plugin2'],
|
|
453
|
+
disabled: ['plugin3'],
|
|
454
|
+
config: {}
|
|
455
|
+
},
|
|
456
|
+
custom: {
|
|
457
|
+
customFeature: true
|
|
458
|
+
}
|
|
459
|
+
} as FluxStackConfig
|
|
460
|
+
|
|
461
|
+
expect(isFeatureEnabled(config, 'plugin1')).toBe(true)
|
|
462
|
+
expect(isFeatureEnabled(config, 'plugin2')).toBe(true)
|
|
463
|
+
expect(isFeatureEnabled(config, 'plugin3')).toBe(false) // disabled
|
|
464
|
+
expect(isFeatureEnabled(config, 'plugin4')).toBe(false) // not in enabled
|
|
465
|
+
expect(isFeatureEnabled(config, 'monitoring')).toBe(true)
|
|
466
|
+
expect(isFeatureEnabled(config, 'metrics')).toBe(true)
|
|
467
|
+
expect(isFeatureEnabled(config, 'profiling')).toBe(false)
|
|
468
|
+
expect(isFeatureEnabled(config, 'customFeature')).toBe(true)
|
|
469
|
+
expect(isFeatureEnabled(config, 'nonexistent')).toBe(false)
|
|
470
|
+
})
|
|
471
|
+
})
|
|
472
|
+
|
|
473
|
+
describe('createLegacyConfig', () => {
|
|
474
|
+
test('creates legacy configuration format', () => {
|
|
475
|
+
const config: FluxStackConfig = {
|
|
476
|
+
app: { name: 'TestApp', version: '1.0.0' },
|
|
477
|
+
server: {
|
|
478
|
+
port: 4000,
|
|
479
|
+
host: 'localhost',
|
|
480
|
+
apiPrefix: '/v2',
|
|
481
|
+
cors: {
|
|
482
|
+
origins: ['http://localhost:3000', 'https://example.com'],
|
|
483
|
+
methods: ['GET', 'POST', 'PUT'],
|
|
484
|
+
headers: ['Content-Type', 'Authorization'],
|
|
485
|
+
credentials: true,
|
|
486
|
+
maxAge: 86400
|
|
487
|
+
},
|
|
488
|
+
middleware: []
|
|
489
|
+
},
|
|
490
|
+
client: {
|
|
491
|
+
port: 5174,
|
|
492
|
+
proxy: { target: 'http://localhost:3000' },
|
|
493
|
+
build: {
|
|
494
|
+
target: 'es2020',
|
|
495
|
+
outDir: 'dist/client',
|
|
496
|
+
sourceMaps: true,
|
|
497
|
+
minify: false
|
|
498
|
+
}
|
|
499
|
+
},
|
|
500
|
+
build: {
|
|
501
|
+
target: 'docker',
|
|
502
|
+
outDir: 'build',
|
|
503
|
+
clean: true,
|
|
504
|
+
optimization: {
|
|
505
|
+
minify: false,
|
|
506
|
+
compress: false,
|
|
507
|
+
treeshake: false,
|
|
508
|
+
splitChunks: false,
|
|
509
|
+
bundleAnalyzer: false
|
|
510
|
+
},
|
|
511
|
+
sourceMaps: true
|
|
512
|
+
},
|
|
513
|
+
logging: {
|
|
514
|
+
level: 'info',
|
|
515
|
+
format: 'pretty',
|
|
516
|
+
transports: [
|
|
517
|
+
{ type: 'console', level: 'info', format: 'pretty' }
|
|
518
|
+
]
|
|
519
|
+
},
|
|
520
|
+
monitoring: {
|
|
521
|
+
enabled: false,
|
|
522
|
+
metrics: {
|
|
523
|
+
enabled: false,
|
|
524
|
+
collectInterval: 60000,
|
|
525
|
+
httpMetrics: true,
|
|
526
|
+
systemMetrics: true,
|
|
527
|
+
customMetrics: false
|
|
528
|
+
},
|
|
529
|
+
profiling: {
|
|
530
|
+
enabled: false,
|
|
531
|
+
sampleRate: 0.1,
|
|
532
|
+
memoryProfiling: false,
|
|
533
|
+
cpuProfiling: false
|
|
534
|
+
},
|
|
535
|
+
exporters: []
|
|
536
|
+
},
|
|
537
|
+
plugins: {
|
|
538
|
+
enabled: [],
|
|
539
|
+
disabled: [],
|
|
540
|
+
config: {}
|
|
541
|
+
}
|
|
542
|
+
} as FluxStackConfig
|
|
543
|
+
|
|
544
|
+
const legacyConfig = createLegacyConfig(config)
|
|
545
|
+
|
|
546
|
+
expect(legacyConfig).toEqual({
|
|
547
|
+
port: 4000,
|
|
548
|
+
vitePort: 5174,
|
|
549
|
+
clientPath: 'app/client',
|
|
550
|
+
apiPrefix: '/v2',
|
|
551
|
+
cors: {
|
|
552
|
+
origins: ['http://localhost:3000', 'https://example.com'],
|
|
553
|
+
methods: ['GET', 'POST', 'PUT'],
|
|
554
|
+
headers: ['Content-Type', 'Authorization']
|
|
555
|
+
},
|
|
556
|
+
build: {
|
|
557
|
+
outDir: 'build',
|
|
558
|
+
target: 'docker'
|
|
559
|
+
}
|
|
560
|
+
})
|
|
561
|
+
})
|
|
562
|
+
})
|
|
563
|
+
|
|
564
|
+
describe('error handling and warnings', () => {
|
|
565
|
+
test('handles configuration with warnings gracefully', () => {
|
|
566
|
+
// Test with invalid environment variables that should generate warnings
|
|
567
|
+
process.env.PORT = 'invalid-port' // Should fall back to default
|
|
568
|
+
process.env.LOG_LEVEL = 'invalid-level' // Should fall back to default
|
|
569
|
+
process.env.BUILD_TARGET = 'invalid-target' // Should fall back to default
|
|
570
|
+
|
|
571
|
+
expect(() => {
|
|
572
|
+
const config = getConfigSync()
|
|
573
|
+
// Should not throw, but use defaults
|
|
574
|
+
expect(typeof config.server?.port).toBe('number')
|
|
575
|
+
expect(['debug', 'info', 'warn', 'error']).toContain(config.logging?.level)
|
|
576
|
+
expect(['bun', 'node', 'docker']).toContain(config.build?.target)
|
|
577
|
+
}).not.toThrow()
|
|
578
|
+
})
|
|
579
|
+
|
|
580
|
+
test('handles missing optional configurations', () => {
|
|
581
|
+
// No environment variables set
|
|
582
|
+
const config = getConfigSync()
|
|
583
|
+
|
|
584
|
+
// Should have default values and structure
|
|
585
|
+
expect(config).toBeDefined()
|
|
586
|
+
expect(config.app).toBeDefined()
|
|
587
|
+
expect(config.server).toBeDefined()
|
|
588
|
+
expect(config.plugins).toBeDefined()
|
|
589
|
+
})
|
|
590
|
+
})
|
|
591
|
+
})
|