create-fluxstack 1.0.13 → 1.0.14
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/.env.example +29 -29
- package/app/client/README.md +69 -69
- package/app/client/index.html +14 -13
- package/app/client/src/App.tsx +157 -524
- package/app/client/src/components/ErrorBoundary.tsx +107 -0
- package/app/client/src/components/ErrorDisplay.css +365 -0
- package/app/client/src/components/ErrorDisplay.tsx +258 -0
- package/app/client/src/components/FluxStackConfig.tsx +1321 -0
- package/app/client/src/components/HybridLiveCounter.tsx +140 -0
- package/app/client/src/components/LiveClock.tsx +286 -0
- package/app/client/src/components/MainLayout.tsx +390 -0
- package/app/client/src/components/SidebarNavigation.tsx +391 -0
- package/app/client/src/components/StateDemo.tsx +178 -0
- package/app/client/src/components/SystemMonitor.tsx +1038 -0
- package/app/client/src/components/Teste.tsx +104 -0
- package/app/client/src/components/UserProfile.tsx +809 -0
- package/app/client/src/hooks/useAuth.ts +39 -0
- package/app/client/src/hooks/useNotifications.ts +56 -0
- package/app/client/src/lib/eden-api.ts +189 -53
- package/app/client/src/lib/errors.ts +340 -0
- package/app/client/src/lib/hooks/useErrorHandler.ts +258 -0
- package/app/client/src/lib/index.ts +45 -0
- package/app/client/src/main.tsx +3 -2
- package/app/client/src/pages/ApiDocs.tsx +182 -0
- package/app/client/src/pages/Demo.tsx +174 -0
- package/app/client/src/pages/HybridLive.tsx +263 -0
- package/app/client/src/pages/Overview.tsx +155 -0
- package/app/client/src/store/README.md +43 -0
- package/app/client/src/store/index.ts +16 -0
- package/app/client/src/store/slices/uiSlice.ts +151 -0
- package/app/client/src/store/slices/userSlice.ts +161 -0
- package/app/client/src/test/README.md +257 -0
- package/app/client/src/test/setup.ts +70 -0
- package/app/client/src/test/types.ts +12 -0
- package/app/client/src/vite-env.d.ts +1 -1
- package/app/client/tsconfig.app.json +44 -43
- package/app/client/tsconfig.json +7 -7
- package/app/client/tsconfig.node.json +25 -25
- package/app/client/zustand-setup.md +65 -0
- package/app/server/controllers/users.controller.ts +68 -68
- package/app/server/index.ts +9 -1
- package/app/server/live/CounterComponent.ts +191 -0
- package/app/server/live/FluxStackConfig.ts +529 -0
- package/app/server/live/LiveClockComponent.ts +214 -0
- package/app/server/live/SidebarNavigation.ts +156 -0
- package/app/server/live/SystemMonitor.ts +594 -0
- package/app/server/live/SystemMonitorIntegration.ts +151 -0
- package/app/server/live/TesteComponent.ts +87 -0
- package/app/server/live/UserProfileComponent.ts +135 -0
- package/app/server/live/register-components.ts +28 -0
- package/app/server/middleware/auth.ts +136 -0
- package/app/server/middleware/errorHandling.ts +250 -0
- package/app/server/middleware/index.ts +10 -0
- package/app/server/middleware/rateLimit.ts +193 -0
- package/app/server/middleware/requestLogging.ts +215 -0
- package/app/server/middleware/validation.ts +270 -0
- package/app/server/routes/index.ts +14 -2
- package/app/server/routes/upload.ts +92 -0
- package/app/server/routes/users.routes.ts +2 -9
- package/app/server/services/NotificationService.ts +302 -0
- package/app/server/services/UserService.ts +222 -0
- package/app/server/services/index.ts +46 -0
- package/core/cli/commands/plugin-deps.ts +263 -0
- package/core/cli/generators/README.md +339 -0
- package/core/cli/generators/component.ts +770 -0
- package/core/cli/generators/controller.ts +299 -0
- package/core/cli/generators/index.ts +144 -0
- package/core/cli/generators/interactive.ts +228 -0
- package/core/cli/generators/prompts.ts +83 -0
- package/core/cli/generators/route.ts +513 -0
- package/core/cli/generators/service.ts +465 -0
- package/core/cli/generators/template-engine.ts +154 -0
- package/core/cli/generators/types.ts +71 -0
- package/core/cli/generators/utils.ts +192 -0
- package/core/cli/index.ts +69 -0
- package/core/cli/plugin-discovery.ts +16 -85
- package/core/client/fluxstack.ts +17 -0
- package/core/client/hooks/index.ts +7 -0
- package/core/client/hooks/state-validator.ts +130 -0
- package/core/client/hooks/useAuth.ts +49 -0
- package/core/client/hooks/useChunkedUpload.ts +258 -0
- package/core/client/hooks/useHybridLiveComponent.ts +967 -0
- package/core/client/hooks/useWebSocket.ts +373 -0
- package/core/client/index.ts +47 -0
- package/core/client/state/createStore.ts +193 -0
- package/core/client/state/index.ts +15 -0
- package/core/config/env-dynamic.ts +1 -1
- package/core/config/env.ts +2 -1
- package/core/config/runtime-config.ts +3 -3
- package/core/config/schema.ts +84 -49
- package/core/framework/server.ts +30 -0
- package/core/index.ts +25 -0
- package/core/live/ComponentRegistry.ts +399 -0
- package/core/live/types.ts +164 -0
- package/core/plugins/built-in/live-components/commands/create-live-component.ts +1201 -0
- package/core/plugins/built-in/live-components/index.ts +27 -0
- package/core/plugins/built-in/logger/index.ts +1 -1
- package/core/plugins/built-in/monitoring/index.ts +1 -1
- package/core/plugins/built-in/static/index.ts +1 -1
- package/core/plugins/built-in/swagger/index.ts +1 -1
- package/core/plugins/built-in/vite/index.ts +1 -1
- package/core/plugins/dependency-manager.ts +384 -0
- package/core/plugins/index.ts +5 -1
- package/core/plugins/manager.ts +7 -3
- package/core/plugins/registry.ts +88 -10
- package/core/plugins/types.ts +11 -11
- package/core/server/framework.ts +43 -0
- package/core/server/index.ts +11 -1
- package/core/server/live/ComponentRegistry.ts +1017 -0
- package/core/server/live/FileUploadManager.ts +272 -0
- package/core/server/live/LiveComponentPerformanceMonitor.ts +930 -0
- package/core/server/live/SingleConnectionManager.ts +0 -0
- package/core/server/live/StateSignature.ts +644 -0
- package/core/server/live/WebSocketConnectionManager.ts +688 -0
- package/core/server/live/websocket-plugin.ts +435 -0
- package/core/server/middleware/errorHandling.ts +141 -0
- package/core/server/middleware/index.ts +16 -0
- package/core/server/plugins/static-files-plugin.ts +232 -0
- package/core/server/services/BaseService.ts +95 -0
- package/core/server/services/ServiceContainer.ts +144 -0
- package/core/server/services/index.ts +9 -0
- package/core/templates/create-project.ts +46 -2
- package/core/testing/index.ts +10 -0
- package/core/testing/setup.ts +74 -0
- package/core/types/build.ts +38 -14
- package/core/types/types.ts +319 -0
- package/core/utils/env-runtime.ts +7 -0
- package/core/utils/errors/handlers.ts +264 -39
- package/core/utils/errors/index.ts +528 -18
- package/core/utils/errors/middleware.ts +114 -0
- package/core/utils/logger/formatters.ts +222 -0
- package/core/utils/logger/index.ts +167 -48
- package/core/utils/logger/middleware.ts +253 -0
- package/core/utils/logger/performance.ts +384 -0
- package/core/utils/logger/transports.ts +365 -0
- package/create-fluxstack.ts +296 -296
- package/fluxstack.config.ts +17 -1
- package/package-template.json +66 -66
- package/package.json +31 -6
- package/public/README.md +16 -0
- package/vite.config.ts +29 -14
- package/.claude/settings.local.json +0 -74
- package/.github/workflows/ci-build-tests.yml +0 -480
- package/.github/workflows/dependency-management.yml +0 -324
- package/.github/workflows/release-validation.yml +0 -355
- package/.kiro/specs/fluxstack-architecture-optimization/design.md +0 -700
- package/.kiro/specs/fluxstack-architecture-optimization/requirements.md +0 -127
- package/.kiro/specs/fluxstack-architecture-optimization/tasks.md +0 -330
- package/CLAUDE.md +0 -200
- package/Dockerfile +0 -58
- package/Dockerfile.backend +0 -52
- package/Dockerfile.frontend +0 -54
- package/README-Docker.md +0 -85
- package/ai-context/00-QUICK-START.md +0 -86
- package/ai-context/README.md +0 -88
- package/ai-context/development/eden-treaty-guide.md +0 -362
- package/ai-context/development/patterns.md +0 -382
- package/ai-context/development/plugins-guide.md +0 -572
- package/ai-context/examples/crud-complete.md +0 -626
- package/ai-context/project/architecture.md +0 -399
- package/ai-context/project/overview.md +0 -213
- package/ai-context/recent-changes/eden-treaty-refactor.md +0 -281
- package/ai-context/recent-changes/type-inference-fix.md +0 -223
- package/ai-context/reference/environment-vars.md +0 -384
- package/ai-context/reference/troubleshooting.md +0 -407
- package/app/client/src/components/TestPage.tsx +0 -453
- package/bun.lock +0 -1063
- package/bunfig.toml +0 -16
- package/core/__tests__/integration.test.ts +0 -227
- package/core/build/index.ts +0 -186
- package/core/config/__tests__/config-loader.test.ts +0 -554
- package/core/config/__tests__/config-merger.test.ts +0 -657
- package/core/config/__tests__/env-converter.test.ts +0 -372
- package/core/config/__tests__/env-processor.test.ts +0 -431
- package/core/config/__tests__/env.test.ts +0 -452
- package/core/config/__tests__/integration.test.ts +0 -418
- package/core/config/__tests__/loader.test.ts +0 -331
- package/core/config/__tests__/schema.test.ts +0 -129
- package/core/config/__tests__/validator.test.ts +0 -318
- package/core/framework/__tests__/server.test.ts +0 -233
- package/core/plugins/__tests__/built-in.test.ts.disabled +0 -366
- package/core/plugins/__tests__/manager.test.ts +0 -398
- package/core/plugins/__tests__/monitoring.test.ts +0 -401
- package/core/plugins/__tests__/registry.test.ts +0 -335
- package/core/utils/__tests__/errors.test.ts +0 -139
- package/core/utils/__tests__/helpers.test.ts +0 -297
- package/core/utils/__tests__/logger.test.ts +0 -141
- package/create-test-app.ts +0 -156
- package/docker-compose.microservices.yml +0 -75
- package/docker-compose.simple.yml +0 -57
- package/docker-compose.yml +0 -71
- package/eslint.config.js +0 -23
- package/flux-cli.ts +0 -214
- package/nginx-lb.conf +0 -37
- package/publish.sh +0 -63
- package/run-clean.ts +0 -26
- package/run-env-tests.ts +0 -313
- package/tailwind.config.js +0 -34
- package/tests/__mocks__/api.ts +0 -56
- package/tests/fixtures/users.ts +0 -69
- package/tests/integration/api/users.routes.test.ts +0 -221
- package/tests/setup.ts +0 -29
- package/tests/unit/app/client/App-simple.test.tsx +0 -56
- package/tests/unit/app/client/App.test.tsx.skip +0 -237
- package/tests/unit/app/client/eden-api.test.ts +0 -186
- package/tests/unit/app/client/simple.test.tsx +0 -23
- package/tests/unit/app/controllers/users.controller.test.ts +0 -150
- package/tests/unit/core/create-project.test.ts.skip +0 -95
- package/tests/unit/core/framework.test.ts +0 -144
- package/tests/unit/core/plugins/logger.test.ts.skip +0 -268
- package/tests/unit/core/plugins/vite.test.ts.disabled +0 -188
- package/tests/utils/test-helpers.ts +0 -61
- package/vitest.config.ts +0 -50
- package/workspace.json +0 -6
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
services:
|
|
2
|
-
# Frontend-Only Service (React app)
|
|
3
|
-
frontend:
|
|
4
|
-
image: fluxstack-frontend:latest
|
|
5
|
-
ports:
|
|
6
|
-
- "8080:80" # Acesso direto ao frontend
|
|
7
|
-
environment:
|
|
8
|
-
- API_URL=http://backend:3001
|
|
9
|
-
depends_on:
|
|
10
|
-
- backend
|
|
11
|
-
networks:
|
|
12
|
-
- fluxstack-network
|
|
13
|
-
restart: unless-stopped
|
|
14
|
-
|
|
15
|
-
# Backend-Only Service (API)
|
|
16
|
-
backend:
|
|
17
|
-
image: fluxstack-backend:latest
|
|
18
|
-
ports:
|
|
19
|
-
- "3001:3001" # Acesso direto à API
|
|
20
|
-
environment:
|
|
21
|
-
- NODE_ENV=production
|
|
22
|
-
- BACKEND_PORT=3001
|
|
23
|
-
- DATABASE_URL=postgresql://fluxstack:password@postgres:5432/fluxstack
|
|
24
|
-
- CORS_ORIGINS=http://localhost:8080
|
|
25
|
-
depends_on:
|
|
26
|
-
postgres:
|
|
27
|
-
condition: service_healthy
|
|
28
|
-
networks:
|
|
29
|
-
- fluxstack-network
|
|
30
|
-
restart: unless-stopped
|
|
31
|
-
|
|
32
|
-
# Database
|
|
33
|
-
postgres:
|
|
34
|
-
image: postgres:15-alpine
|
|
35
|
-
environment:
|
|
36
|
-
- POSTGRES_DB=fluxstack
|
|
37
|
-
- POSTGRES_USER=fluxstack
|
|
38
|
-
- POSTGRES_PASSWORD=password
|
|
39
|
-
volumes:
|
|
40
|
-
- postgres_data:/var/lib/postgresql/data
|
|
41
|
-
ports:
|
|
42
|
-
- "5432:5432" # Acesso direto ao DB para debug
|
|
43
|
-
networks:
|
|
44
|
-
- fluxstack-network
|
|
45
|
-
restart: unless-stopped
|
|
46
|
-
healthcheck:
|
|
47
|
-
test: ["CMD-SHELL", "pg_isready -U fluxstack -d fluxstack"]
|
|
48
|
-
interval: 10s
|
|
49
|
-
timeout: 5s
|
|
50
|
-
retries: 5
|
|
51
|
-
|
|
52
|
-
volumes:
|
|
53
|
-
postgres_data:
|
|
54
|
-
|
|
55
|
-
networks:
|
|
56
|
-
fluxstack-network:
|
|
57
|
-
driver: bridge
|
package/docker-compose.yml
DELETED
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
version: '3.8'
|
|
2
|
-
|
|
3
|
-
services:
|
|
4
|
-
# FluxStack Application
|
|
5
|
-
fluxstack:
|
|
6
|
-
build:
|
|
7
|
-
context: .
|
|
8
|
-
dockerfile: Dockerfile
|
|
9
|
-
ports:
|
|
10
|
-
- "3000:3000"
|
|
11
|
-
environment:
|
|
12
|
-
- NODE_ENV=production
|
|
13
|
-
- PORT=3000
|
|
14
|
-
- HOST=0.0.0.0
|
|
15
|
-
- DATABASE_URL=postgresql://fluxstack:password@postgres:5432/fluxstack
|
|
16
|
-
depends_on:
|
|
17
|
-
postgres:
|
|
18
|
-
condition: service_healthy
|
|
19
|
-
networks:
|
|
20
|
-
- fluxstack-network
|
|
21
|
-
restart: unless-stopped
|
|
22
|
-
healthcheck:
|
|
23
|
-
test: ["CMD", "bun", "run", "-e", "fetch('http://localhost:3000/api/health').then(r => r.ok ? process.exit(0) : process.exit(1))"]
|
|
24
|
-
interval: 30s
|
|
25
|
-
timeout: 10s
|
|
26
|
-
retries: 3
|
|
27
|
-
start_period: 10s
|
|
28
|
-
|
|
29
|
-
# PostgreSQL Database
|
|
30
|
-
postgres:
|
|
31
|
-
image: postgres:15-alpine
|
|
32
|
-
environment:
|
|
33
|
-
- POSTGRES_DB=fluxstack
|
|
34
|
-
- POSTGRES_USER=fluxstack
|
|
35
|
-
- POSTGRES_PASSWORD=password
|
|
36
|
-
volumes:
|
|
37
|
-
- postgres_data:/var/lib/postgresql/data
|
|
38
|
-
ports:
|
|
39
|
-
- "5432:5432"
|
|
40
|
-
networks:
|
|
41
|
-
- fluxstack-network
|
|
42
|
-
restart: unless-stopped
|
|
43
|
-
healthcheck:
|
|
44
|
-
test: ["CMD-SHELL", "pg_isready -U fluxstack -d fluxstack"]
|
|
45
|
-
interval: 10s
|
|
46
|
-
timeout: 5s
|
|
47
|
-
retries: 5
|
|
48
|
-
|
|
49
|
-
# Redis Cache (optional)
|
|
50
|
-
redis:
|
|
51
|
-
image: redis:7-alpine
|
|
52
|
-
ports:
|
|
53
|
-
- "6379:6379"
|
|
54
|
-
volumes:
|
|
55
|
-
- redis_data:/data
|
|
56
|
-
networks:
|
|
57
|
-
- fluxstack-network
|
|
58
|
-
restart: unless-stopped
|
|
59
|
-
healthcheck:
|
|
60
|
-
test: ["CMD", "redis-cli", "ping"]
|
|
61
|
-
interval: 10s
|
|
62
|
-
timeout: 5s
|
|
63
|
-
retries: 3
|
|
64
|
-
|
|
65
|
-
volumes:
|
|
66
|
-
postgres_data:
|
|
67
|
-
redis_data:
|
|
68
|
-
|
|
69
|
-
networks:
|
|
70
|
-
fluxstack-network:
|
|
71
|
-
driver: bridge
|
package/eslint.config.js
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import js from '@eslint/js'
|
|
2
|
-
import globals from 'globals'
|
|
3
|
-
import reactHooks from 'eslint-plugin-react-hooks'
|
|
4
|
-
import reactRefresh from 'eslint-plugin-react-refresh'
|
|
5
|
-
import tseslint from 'typescript-eslint'
|
|
6
|
-
import { globalIgnores } from 'eslint/config'
|
|
7
|
-
|
|
8
|
-
export default tseslint.config([
|
|
9
|
-
globalIgnores(['dist']),
|
|
10
|
-
{
|
|
11
|
-
files: ['**/*.{ts,tsx}'],
|
|
12
|
-
extends: [
|
|
13
|
-
js.configs.recommended,
|
|
14
|
-
tseslint.configs.recommended,
|
|
15
|
-
reactHooks.configs['recommended-latest'],
|
|
16
|
-
reactRefresh.configs.vite,
|
|
17
|
-
],
|
|
18
|
-
languageOptions: {
|
|
19
|
-
ecmaVersion: 2020,
|
|
20
|
-
globals: globals.browser,
|
|
21
|
-
},
|
|
22
|
-
},
|
|
23
|
-
])
|
package/flux-cli.ts
DELETED
|
@@ -1,214 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env bun
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* FluxStack CLI - Comando nativo `flux`
|
|
5
|
-
* Permite criar projetos sem dependências externas ou configurações manuais
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
import { promises as fs } from 'fs';
|
|
9
|
-
import path from 'path';
|
|
10
|
-
import { spawn } from 'child_process';
|
|
11
|
-
|
|
12
|
-
interface CreateProjectOptions {
|
|
13
|
-
name: string;
|
|
14
|
-
template?: 'basic' | 'minimal' | 'full';
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
async function createProject(options: CreateProjectOptions) {
|
|
18
|
-
const { name, template = 'basic' } = options;
|
|
19
|
-
const projectPath = path.resolve(name);
|
|
20
|
-
|
|
21
|
-
console.log(`🚀 Creating FluxStack project: ${name}`);
|
|
22
|
-
console.log(`📋 Template: ${template}`);
|
|
23
|
-
console.log(`📁 Location: ${projectPath}`);
|
|
24
|
-
console.log();
|
|
25
|
-
|
|
26
|
-
// Check if directory exists
|
|
27
|
-
try {
|
|
28
|
-
await fs.access(projectPath);
|
|
29
|
-
console.error(`❌ Directory "${name}" already exists`);
|
|
30
|
-
process.exit(1);
|
|
31
|
-
} catch (error: any) {
|
|
32
|
-
if (error.code !== 'ENOENT') {
|
|
33
|
-
throw error;
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
// Create project directory
|
|
38
|
-
await fs.mkdir(projectPath, { recursive: true });
|
|
39
|
-
|
|
40
|
-
// Copy template
|
|
41
|
-
const templatePath = path.resolve(__dirname, 'templates', template);
|
|
42
|
-
await copyDirectory(templatePath, projectPath);
|
|
43
|
-
|
|
44
|
-
// Process placeholders
|
|
45
|
-
await processTemplateFiles(projectPath, {
|
|
46
|
-
PROJECT_NAME: name,
|
|
47
|
-
PROJECT_DESCRIPTION: `A FluxStack application named ${name}`
|
|
48
|
-
});
|
|
49
|
-
|
|
50
|
-
console.log('✅ Project structure created!');
|
|
51
|
-
console.log('📦 Installing dependencies...');
|
|
52
|
-
|
|
53
|
-
// Install dependencies
|
|
54
|
-
await installDependencies(projectPath);
|
|
55
|
-
|
|
56
|
-
console.log();
|
|
57
|
-
console.log('🎉 Project created successfully!');
|
|
58
|
-
console.log();
|
|
59
|
-
console.log('Next steps:');
|
|
60
|
-
console.log(` cd ${name}`);
|
|
61
|
-
console.log(' bun run dev');
|
|
62
|
-
console.log();
|
|
63
|
-
console.log('Happy coding! 🚀');
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
async function copyDirectory(src: string, dest: string, exclude: string[] = ['node_modules', '.git', 'dist']) {
|
|
67
|
-
await fs.mkdir(dest, { recursive: true });
|
|
68
|
-
|
|
69
|
-
try {
|
|
70
|
-
const entries = await fs.readdir(src, { withFileTypes: true });
|
|
71
|
-
|
|
72
|
-
for (const entry of entries) {
|
|
73
|
-
if (exclude.includes(entry.name)) continue;
|
|
74
|
-
|
|
75
|
-
const srcPath = path.join(src, entry.name);
|
|
76
|
-
const destPath = path.join(dest, entry.name);
|
|
77
|
-
|
|
78
|
-
if (entry.isDirectory()) {
|
|
79
|
-
await copyDirectory(srcPath, destPath, exclude);
|
|
80
|
-
} else {
|
|
81
|
-
const content = await fs.readFile(srcPath, 'utf-8');
|
|
82
|
-
await fs.writeFile(destPath, content, 'utf-8');
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
} catch (error) {
|
|
86
|
-
console.error(`❌ Template not found at: ${src}`);
|
|
87
|
-
console.error('Make sure you have the templates directory in your FluxStack installation.');
|
|
88
|
-
process.exit(1);
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
async function processTemplateFiles(
|
|
93
|
-
projectPath: string,
|
|
94
|
-
replacements: Record<string, string>
|
|
95
|
-
) {
|
|
96
|
-
const files = await getAllFiles(projectPath);
|
|
97
|
-
|
|
98
|
-
for (const file of files) {
|
|
99
|
-
// Skip binary files
|
|
100
|
-
if (isBinaryFile(file)) continue;
|
|
101
|
-
|
|
102
|
-
let content = await fs.readFile(file, 'utf-8');
|
|
103
|
-
|
|
104
|
-
// Replace placeholders
|
|
105
|
-
for (const [key, value] of Object.entries(replacements)) {
|
|
106
|
-
const regex = new RegExp(`{{${key}}}`, 'g');
|
|
107
|
-
content = content.replace(regex, value);
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
await fs.writeFile(file, content, 'utf-8');
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
async function getAllFiles(dirPath: string): Promise<string[]> {
|
|
115
|
-
const files: string[] = [];
|
|
116
|
-
const items = await fs.readdir(dirPath, { withFileTypes: true });
|
|
117
|
-
|
|
118
|
-
for (const item of items) {
|
|
119
|
-
const fullPath = path.join(dirPath, item.name);
|
|
120
|
-
|
|
121
|
-
if (item.isDirectory()) {
|
|
122
|
-
files.push(...await getAllFiles(fullPath));
|
|
123
|
-
} else {
|
|
124
|
-
files.push(fullPath);
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
return files;
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
function isBinaryFile(filePath: string): boolean {
|
|
132
|
-
const binaryExtensions = ['.png', '.jpg', '.jpeg', '.gif', '.ico', '.svg', '.woff', '.woff2', '.ttf', '.eot'];
|
|
133
|
-
const ext = path.extname(filePath).toLowerCase();
|
|
134
|
-
return binaryExtensions.includes(ext);
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
async function installDependencies(projectPath: string): Promise<void> {
|
|
138
|
-
return new Promise((resolve, reject) => {
|
|
139
|
-
const install = spawn('bun', ['install'], {
|
|
140
|
-
cwd: projectPath,
|
|
141
|
-
stdio: 'inherit'
|
|
142
|
-
});
|
|
143
|
-
|
|
144
|
-
install.on('close', (code) => {
|
|
145
|
-
if (code === 0) {
|
|
146
|
-
resolve();
|
|
147
|
-
} else {
|
|
148
|
-
reject(new Error(`Dependencies installation failed with code ${code}`));
|
|
149
|
-
}
|
|
150
|
-
});
|
|
151
|
-
|
|
152
|
-
install.on('error', reject);
|
|
153
|
-
});
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
function showHelp() {
|
|
157
|
-
console.log(`
|
|
158
|
-
🚀 FluxStack CLI
|
|
159
|
-
|
|
160
|
-
Usage:
|
|
161
|
-
flux create <project-name> Create a new FluxStack project
|
|
162
|
-
flux create <project-name> --template Specify template (basic, minimal, full)
|
|
163
|
-
flux --help Show this help
|
|
164
|
-
|
|
165
|
-
Examples:
|
|
166
|
-
flux create my-app Create basic project
|
|
167
|
-
flux create my-blog --template basic Create with basic template
|
|
168
|
-
flux create my-api --template minimal Create minimal project
|
|
169
|
-
|
|
170
|
-
Templates:
|
|
171
|
-
basic Full-featured app with frontend and backend (default)
|
|
172
|
-
minimal Just the backend API
|
|
173
|
-
full Everything + advanced features
|
|
174
|
-
|
|
175
|
-
Get started in seconds! 🔥
|
|
176
|
-
`);
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
// Parse command line arguments
|
|
180
|
-
const args = process.argv.slice(2);
|
|
181
|
-
const command = args[0];
|
|
182
|
-
|
|
183
|
-
if (!command || command === '--help' || command === 'help') {
|
|
184
|
-
showHelp();
|
|
185
|
-
process.exit(0);
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
if (command === 'create') {
|
|
189
|
-
const projectName = args[1];
|
|
190
|
-
|
|
191
|
-
if (!projectName) {
|
|
192
|
-
console.error('❌ Please provide a project name');
|
|
193
|
-
console.error('Usage: flux create <project-name>');
|
|
194
|
-
process.exit(1);
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
// Validate project name
|
|
198
|
-
if (!/^[a-zA-Z0-9-_]+$/.test(projectName)) {
|
|
199
|
-
console.error('❌ Project name can only contain letters, numbers, hyphens, and underscores');
|
|
200
|
-
process.exit(1);
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
const templateIndex = args.indexOf('--template');
|
|
204
|
-
const template = templateIndex !== -1 ? args[templateIndex + 1] as 'basic' | 'minimal' | 'full' : 'basic';
|
|
205
|
-
|
|
206
|
-
createProject({ name: projectName, template }).catch(error => {
|
|
207
|
-
console.error('❌ Error creating project:', error.message);
|
|
208
|
-
process.exit(1);
|
|
209
|
-
});
|
|
210
|
-
} else {
|
|
211
|
-
console.error(`❌ Unknown command: ${command}`);
|
|
212
|
-
console.error('Run "flux --help" for available commands');
|
|
213
|
-
process.exit(1);
|
|
214
|
-
}
|
package/nginx-lb.conf
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
# Load Balancer Configuration
|
|
2
|
-
upstream backend_api {
|
|
3
|
-
server backend:3001;
|
|
4
|
-
}
|
|
5
|
-
|
|
6
|
-
upstream frontend_app {
|
|
7
|
-
server frontend:80;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
server {
|
|
11
|
-
listen 80;
|
|
12
|
-
server_name localhost;
|
|
13
|
-
|
|
14
|
-
# Route API calls to backend
|
|
15
|
-
location /api/ {
|
|
16
|
-
proxy_pass http://backend_api;
|
|
17
|
-
proxy_set_header Host $host;
|
|
18
|
-
proxy_set_header X-Real-IP $remote_addr;
|
|
19
|
-
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
20
|
-
proxy_set_header X-Forwarded-Proto $scheme;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
# Route health checks to backend
|
|
24
|
-
location /health {
|
|
25
|
-
proxy_pass http://backend_api/health;
|
|
26
|
-
proxy_set_header Host $host;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
# Route everything else to frontend
|
|
30
|
-
location / {
|
|
31
|
-
proxy_pass http://frontend_app;
|
|
32
|
-
proxy_set_header Host $host;
|
|
33
|
-
proxy_set_header X-Real-IP $remote_addr;
|
|
34
|
-
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
35
|
-
proxy_set_header X-Forwarded-Proto $scheme;
|
|
36
|
-
}
|
|
37
|
-
}
|
package/publish.sh
DELETED
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
#!/bin/bash
|
|
2
|
-
|
|
3
|
-
# 🚀 FluxStack CLI Publication Script
|
|
4
|
-
# Este script automatiza a publicação do create-fluxstack no NPM
|
|
5
|
-
|
|
6
|
-
set -e
|
|
7
|
-
|
|
8
|
-
echo "⚡ FluxStack CLI Publication Setup"
|
|
9
|
-
echo "================================"
|
|
10
|
-
|
|
11
|
-
# Check if we're in the right directory
|
|
12
|
-
if [[ ! -f "create-fluxstack.ts" ]]; then
|
|
13
|
-
echo "❌ create-fluxstack.ts not found. Run this script from FluxStack root directory."
|
|
14
|
-
exit 1
|
|
15
|
-
fi
|
|
16
|
-
|
|
17
|
-
echo "📋 Pre-publication checklist:"
|
|
18
|
-
echo ""
|
|
19
|
-
|
|
20
|
-
# 1. Test CLI
|
|
21
|
-
echo "🧪 Testing CLI..."
|
|
22
|
-
if ./create-fluxstack.ts test-publish-app --no-install --no-git; then
|
|
23
|
-
echo "✅ CLI test passed"
|
|
24
|
-
rm -rf test-publish-app
|
|
25
|
-
else
|
|
26
|
-
echo "❌ CLI test failed"
|
|
27
|
-
exit 1
|
|
28
|
-
fi
|
|
29
|
-
|
|
30
|
-
# 2. Setup package.json for publication
|
|
31
|
-
echo "📦 Setting up package.json..."
|
|
32
|
-
cp package-cli.json package.json.publish
|
|
33
|
-
echo "✅ Package configuration ready"
|
|
34
|
-
|
|
35
|
-
# 3. Setup README for publication
|
|
36
|
-
echo "📖 Setting up README..."
|
|
37
|
-
cp README-CLI.md README.publish.md
|
|
38
|
-
echo "✅ README ready"
|
|
39
|
-
|
|
40
|
-
echo ""
|
|
41
|
-
echo "🎯 Ready to publish! Next steps:"
|
|
42
|
-
echo ""
|
|
43
|
-
echo "1. Review files:"
|
|
44
|
-
echo " - package.json.publish"
|
|
45
|
-
echo " - README.publish.md"
|
|
46
|
-
echo " - create-fluxstack.ts"
|
|
47
|
-
echo ""
|
|
48
|
-
echo "2. Publish to NPM:"
|
|
49
|
-
echo " cp package.json.publish package.json"
|
|
50
|
-
echo " cp README.publish.md README.md"
|
|
51
|
-
echo " npm login"
|
|
52
|
-
echo " npm publish"
|
|
53
|
-
echo ""
|
|
54
|
-
echo "3. Or create GitHub release:"
|
|
55
|
-
echo " git add ."
|
|
56
|
-
echo " git commit -m 'feat: create-fluxstack CLI v1.0.0'"
|
|
57
|
-
echo " git tag v1.0.0"
|
|
58
|
-
echo " git push origin main --tags"
|
|
59
|
-
echo ""
|
|
60
|
-
echo "4. Test installation:"
|
|
61
|
-
echo " bunx create-fluxstack my-test-app"
|
|
62
|
-
echo ""
|
|
63
|
-
echo "🚀 Ready to make FluxStack available to the world!"
|
package/run-clean.ts
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env bun
|
|
2
|
-
/**
|
|
3
|
-
* Clean server runner that filters Elysia HEAD bug errors
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
// Redirect stderr to filter out HEAD errors
|
|
7
|
-
const originalWrite = process.stderr.write;
|
|
8
|
-
|
|
9
|
-
process.stderr.write = function(chunk: any, encoding?: any, callback?: any) {
|
|
10
|
-
const str = chunk.toString();
|
|
11
|
-
|
|
12
|
-
// Filter out Elysia HEAD bug errors
|
|
13
|
-
if (str.includes("TypeError: undefined is not an object (evaluating '_res.headers.set')") ||
|
|
14
|
-
str.includes("HEAD - / failed")) {
|
|
15
|
-
// Silently ignore these errors
|
|
16
|
-
if (callback) callback();
|
|
17
|
-
return true;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
// Pass through all other stderr
|
|
21
|
-
return originalWrite.call(process.stderr, chunk, encoding, callback);
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
// Now run the server
|
|
25
|
-
console.log('🚀 Starting FluxStack with filtered output...\n');
|
|
26
|
-
await import('./app/server/index.ts');
|