create-fluxstack 1.8.1 → 1.9.1
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 +19 -0
- package/README.md +653 -272
- package/app/client/SIMPLIFICATION.md +140 -0
- package/app/client/frontend-only.ts +1 -1
- package/app/client/src/App.tsx +148 -283
- package/app/client/src/index.css +5 -20
- package/app/client/src/lib/eden-api.ts +53 -220
- package/app/client/src/main.tsx +2 -3
- package/app/server/controllers/users.controller.ts +57 -31
- package/app/server/index.ts +5 -2
- package/app/server/live/register-components.ts +18 -7
- package/app/server/routes/env-test.ts +53 -2
- package/app/server/routes/index.ts +1 -8
- package/app/server/routes/users.routes.ts +192 -91
- package/config/fluxstack.config.ts +2 -2
- package/config/plugins.config.ts +22 -1
- package/core/build/bundler.ts +199 -55
- package/core/build/flux-plugins-generator.ts +5 -5
- package/core/build/index.ts +4 -0
- package/core/build/live-components-generator.ts +15 -12
- package/core/cli/command-registry.ts +4 -14
- package/core/cli/commands/plugin-deps.ts +8 -8
- package/core/cli/generators/component.ts +3 -3
- package/core/cli/generators/controller.ts +4 -4
- package/core/cli/generators/index.ts +8 -8
- package/core/cli/generators/interactive.ts +4 -4
- package/core/cli/generators/plugin.ts +9 -9
- package/core/cli/generators/prompts.ts +1 -1
- package/core/cli/generators/route.ts +27 -11
- package/core/cli/generators/service.ts +5 -5
- package/core/cli/generators/template-engine.ts +1 -1
- package/core/cli/generators/types.ts +1 -1
- package/core/cli/index.ts +258 -193
- package/core/cli/plugin-discovery.ts +3 -3
- package/core/client/hooks/index.ts +2 -2
- package/core/client/hooks/state-validator.ts +1 -1
- package/core/client/hooks/useAuth.ts +1 -1
- package/core/client/hooks/useChunkedUpload.ts +1 -1
- package/core/client/hooks/useHybridLiveComponent.ts +1 -1
- package/core/client/hooks/useWebSocket.ts +1 -1
- package/core/config/env.ts +1 -1
- package/core/config/runtime-config.ts +5 -5
- package/core/config/schema.ts +9 -0
- package/core/framework/server.ts +30 -15
- package/core/framework/types.ts +2 -2
- package/core/live/ComponentRegistry.ts +1 -1
- package/core/plugins/built-in/live-components/commands/create-live-component.ts +1 -1
- package/core/plugins/built-in/live-components/index.ts +1 -1
- package/core/plugins/built-in/monitoring/index.ts +65 -161
- package/core/plugins/built-in/static/index.ts +18 -47
- package/core/plugins/built-in/swagger/index.ts +301 -231
- package/core/plugins/built-in/vite/index.ts +74 -109
- package/core/plugins/config.ts +2 -2
- package/core/plugins/dependency-manager.ts +2 -2
- package/core/plugins/discovery.ts +1 -1
- package/core/plugins/executor.ts +2 -2
- package/core/plugins/manager.ts +19 -4
- package/core/plugins/module-resolver.ts +1 -1
- package/core/plugins/registry.ts +3 -3
- package/core/plugins/types.ts +147 -5
- package/core/server/framework.ts +2 -2
- package/core/server/live/ComponentRegistry.ts +9 -26
- package/core/server/live/FileUploadManager.ts +1 -1
- package/core/server/live/auto-generated-components.ts +26 -0
- package/core/server/live/websocket-plugin.ts +211 -19
- package/core/server/middleware/errorHandling.ts +1 -1
- package/core/server/middleware/index.ts +4 -4
- package/core/server/plugins/database.ts +1 -2
- package/core/server/plugins/static-files-plugin.ts +259 -231
- package/core/server/plugins/swagger.ts +1 -1
- package/core/server/services/BaseService.ts +1 -1
- package/core/server/services/ServiceContainer.ts +1 -1
- package/core/server/services/index.ts +4 -4
- package/core/server/standalone.ts +16 -1
- package/core/testing/index.ts +1 -1
- package/core/testing/setup.ts +1 -1
- package/core/types/build.ts +21 -0
- package/core/utils/logger/startup-banner.ts +7 -33
- package/core/utils/version.ts +1 -1
- package/create-fluxstack.ts +73 -30
- package/package.json +3 -2
- package/plugins/crypto-auth/index.ts +52 -47
- package/plugins/crypto-auth/server/AuthMiddleware.ts +1 -1
- package/plugins/crypto-auth/server/middlewares/helpers.ts +16 -1
- package/tsconfig.json +2 -1
- package/vitest.config.ts +11 -2
- package/app/client/src/App.css +0 -883
- package/app/client/src/components/ErrorBoundary.tsx +0 -107
- package/app/client/src/components/ErrorDisplay.css +0 -365
- package/app/client/src/components/ErrorDisplay.tsx +0 -258
- package/app/client/src/components/FluxStackConfig.tsx +0 -1321
- package/app/client/src/components/HybridLiveCounter.tsx +0 -140
- package/app/client/src/components/LiveClock.tsx +0 -286
- package/app/client/src/components/MainLayout.tsx +0 -388
- package/app/client/src/components/SidebarNavigation.tsx +0 -391
- package/app/client/src/components/StateDemo.tsx +0 -178
- package/app/client/src/components/SystemMonitor.tsx +0 -1044
- package/app/client/src/components/UserProfile.tsx +0 -809
- package/app/client/src/hooks/useAuth.ts +0 -39
- package/app/client/src/hooks/useNotifications.ts +0 -56
- package/app/client/src/lib/errors.ts +0 -340
- package/app/client/src/lib/hooks/useErrorHandler.ts +0 -258
- package/app/client/src/lib/index.ts +0 -45
- package/app/client/src/pages/ApiDocs.tsx +0 -182
- package/app/client/src/pages/CryptoAuthPage.tsx +0 -394
- package/app/client/src/pages/Demo.tsx +0 -174
- package/app/client/src/pages/HybridLive.tsx +0 -263
- package/app/client/src/pages/Overview.tsx +0 -155
- package/app/client/src/store/README.md +0 -43
- package/app/client/src/store/index.ts +0 -16
- package/app/client/src/store/slices/uiSlice.ts +0 -151
- package/app/client/src/store/slices/userSlice.ts +0 -161
- package/app/client/src/test/README.md +0 -257
- package/app/client/src/test/setup.ts +0 -70
- package/app/client/src/test/types.ts +0 -12
- package/app/server/live/CounterComponent.ts +0 -191
- package/app/server/live/FluxStackConfig.ts +0 -534
- package/app/server/live/SidebarNavigation.ts +0 -157
- package/app/server/live/SystemMonitor.ts +0 -595
- package/app/server/live/SystemMonitorIntegration.ts +0 -151
- package/app/server/live/UserProfileComponent.ts +0 -141
- package/app/server/middleware/auth.ts +0 -136
- package/app/server/middleware/errorHandling.ts +0 -252
- package/app/server/middleware/index.ts +0 -10
- package/app/server/middleware/rateLimit.ts +0 -193
- package/app/server/middleware/requestLogging.ts +0 -215
- package/app/server/middleware/validation.ts +0 -270
- package/app/server/routes/config.ts +0 -145
- package/app/server/routes/crypto-auth-demo.routes.ts +0 -167
- package/app/server/routes/example-with-crypto-auth.routes.ts +0 -235
- package/app/server/routes/exemplo-posts.routes.ts +0 -161
- package/app/server/routes/upload.ts +0 -92
- package/app/server/services/NotificationService.ts +0 -302
- package/app/server/services/UserService.ts +0 -222
- package/app/server/services/index.ts +0 -46
- package/app/server/types/index.ts +0 -1
package/core/cli/index.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
#!/usr/bin/env bun
|
|
2
2
|
|
|
3
|
-
import { FluxStackBuilder } from "
|
|
4
|
-
import { ProjectCreator } from "
|
|
5
|
-
import { getConfigSync } from "
|
|
3
|
+
import { FluxStackBuilder } from "@/core/build"
|
|
4
|
+
import { ProjectCreator } from "@/core/templates/create-project"
|
|
5
|
+
import { getConfigSync } from "@/core/config"
|
|
6
6
|
import { cliRegistry } from "./command-registry"
|
|
7
7
|
import { pluginDiscovery } from "./plugin-discovery"
|
|
8
|
-
import { generateCommand, interactiveGenerateCommand } from "./generators/index
|
|
9
|
-
import { startGroup, endGroup, logBox, logInGroup } from "
|
|
8
|
+
import { generateCommand, interactiveGenerateCommand } from "./generators/index"
|
|
9
|
+
import { startGroup, endGroup, logBox, logInGroup } from "@/core/utils/logger/group-logger"
|
|
10
10
|
|
|
11
11
|
const command = process.argv[2]
|
|
12
12
|
const args = process.argv.slice(3)
|
|
@@ -138,14 +138,14 @@ Examples:
|
|
|
138
138
|
// Grouped startup messages
|
|
139
139
|
startGroup({
|
|
140
140
|
title: 'FluxStack Development Server',
|
|
141
|
-
icon: '
|
|
141
|
+
icon: '',
|
|
142
142
|
color: 'cyan'
|
|
143
143
|
})
|
|
144
144
|
|
|
145
|
-
logInGroup(`
|
|
146
|
-
logInGroup(`
|
|
147
|
-
logInGroup(
|
|
148
|
-
logInGroup('Starting
|
|
145
|
+
logInGroup(`Server: http://localhost:${options.port}`, '')
|
|
146
|
+
logInGroup(`API: http://localhost:${options.port}/api`, '')
|
|
147
|
+
logInGroup(`Swagger: http://localhost:${options.port}/swagger`, '')
|
|
148
|
+
logInGroup('Starting with hot reload...', '')
|
|
149
149
|
|
|
150
150
|
endGroup()
|
|
151
151
|
console.log('') // Separator line
|
|
@@ -325,7 +325,7 @@ Examples:
|
|
|
325
325
|
}
|
|
326
326
|
|
|
327
327
|
// Use the plugin generator
|
|
328
|
-
const { generatorRegistry } = await import('./generators/index
|
|
328
|
+
const { generatorRegistry } = await import('./generators/index')
|
|
329
329
|
const pluginGenerator = generatorRegistry.get('plugin')
|
|
330
330
|
|
|
331
331
|
if (!pluginGenerator) {
|
|
@@ -356,6 +356,248 @@ Examples:
|
|
|
356
356
|
}
|
|
357
357
|
}
|
|
358
358
|
})
|
|
359
|
+
|
|
360
|
+
// Frontend command (frontend-only development)
|
|
361
|
+
cliRegistry.register({
|
|
362
|
+
name: 'frontend',
|
|
363
|
+
description: 'Start frontend development server only',
|
|
364
|
+
category: 'Development',
|
|
365
|
+
usage: 'flux frontend [options]',
|
|
366
|
+
examples: [
|
|
367
|
+
'flux frontend # Start Vite dev server on port 5173',
|
|
368
|
+
'flux frontend --port 3000 # Start on custom port'
|
|
369
|
+
],
|
|
370
|
+
options: [
|
|
371
|
+
{
|
|
372
|
+
name: 'port',
|
|
373
|
+
short: 'p',
|
|
374
|
+
description: 'Port for frontend server',
|
|
375
|
+
type: 'number',
|
|
376
|
+
default: 5173
|
|
377
|
+
}
|
|
378
|
+
],
|
|
379
|
+
handler: async (args, options, context) => {
|
|
380
|
+
console.log("🎨 FluxStack Frontend Development")
|
|
381
|
+
console.log(`🌐 Frontend: http://localhost:${options.port}`)
|
|
382
|
+
console.log("📦 Starting Vite dev server...")
|
|
383
|
+
console.log()
|
|
384
|
+
|
|
385
|
+
const { spawn } = await import("child_process")
|
|
386
|
+
const frontendProcess = spawn("vite", ["--config", "vite.config.ts", "--port", options.port.toString()], {
|
|
387
|
+
stdio: "inherit",
|
|
388
|
+
cwd: process.cwd()
|
|
389
|
+
})
|
|
390
|
+
|
|
391
|
+
process.on('SIGINT', () => {
|
|
392
|
+
frontendProcess.kill('SIGINT')
|
|
393
|
+
process.exit(0)
|
|
394
|
+
})
|
|
395
|
+
|
|
396
|
+
return new Promise((resolve) => {
|
|
397
|
+
frontendProcess.on('exit', resolve)
|
|
398
|
+
})
|
|
399
|
+
}
|
|
400
|
+
})
|
|
401
|
+
|
|
402
|
+
// Backend command (backend-only development)
|
|
403
|
+
cliRegistry.register({
|
|
404
|
+
name: 'backend',
|
|
405
|
+
description: 'Start backend development server only',
|
|
406
|
+
category: 'Development',
|
|
407
|
+
usage: 'flux backend [options]',
|
|
408
|
+
examples: [
|
|
409
|
+
'flux backend # Start backend on port 3001',
|
|
410
|
+
'flux backend --port 4000 # Start on custom port'
|
|
411
|
+
],
|
|
412
|
+
options: [
|
|
413
|
+
{
|
|
414
|
+
name: 'port',
|
|
415
|
+
short: 'p',
|
|
416
|
+
description: 'Port for backend server',
|
|
417
|
+
type: 'number',
|
|
418
|
+
default: 3001
|
|
419
|
+
}
|
|
420
|
+
],
|
|
421
|
+
handler: async (args, options, context) => {
|
|
422
|
+
console.log("⚡ FluxStack Backend Development")
|
|
423
|
+
console.log(`🚀 API Server: http://localhost:${options.port}`)
|
|
424
|
+
console.log("📦 Starting backend with hot reload...")
|
|
425
|
+
console.log()
|
|
426
|
+
|
|
427
|
+
// Ensure backend-only.ts exists
|
|
428
|
+
const { ensureBackendEntry } = await import("../utils/regenerate-files")
|
|
429
|
+
await ensureBackendEntry()
|
|
430
|
+
|
|
431
|
+
// Start backend with Bun watch for hot reload
|
|
432
|
+
const { spawn } = await import("child_process")
|
|
433
|
+
const backendProcess = spawn("bun", ["--watch", "app/server/backend-only.ts"], {
|
|
434
|
+
stdio: "inherit",
|
|
435
|
+
cwd: process.cwd(),
|
|
436
|
+
env: {
|
|
437
|
+
...process.env,
|
|
438
|
+
BACKEND_PORT: options.port.toString()
|
|
439
|
+
}
|
|
440
|
+
})
|
|
441
|
+
|
|
442
|
+
// Handle process cleanup
|
|
443
|
+
process.on('SIGINT', () => {
|
|
444
|
+
backendProcess.kill('SIGINT')
|
|
445
|
+
process.exit(0)
|
|
446
|
+
})
|
|
447
|
+
|
|
448
|
+
return new Promise((resolve) => {
|
|
449
|
+
backendProcess.on('exit', resolve)
|
|
450
|
+
})
|
|
451
|
+
}
|
|
452
|
+
})
|
|
453
|
+
|
|
454
|
+
// Start command (production server)
|
|
455
|
+
cliRegistry.register({
|
|
456
|
+
name: 'start',
|
|
457
|
+
description: 'Start production server',
|
|
458
|
+
category: 'Production',
|
|
459
|
+
usage: 'flux start',
|
|
460
|
+
examples: [
|
|
461
|
+
'flux start # Start production server from dist/'
|
|
462
|
+
],
|
|
463
|
+
handler: async (args, options, context) => {
|
|
464
|
+
console.log("🚀 Starting FluxStack production server...")
|
|
465
|
+
const { join } = await import("path")
|
|
466
|
+
await import(join(process.cwd(), "dist", "index.js"))
|
|
467
|
+
}
|
|
468
|
+
})
|
|
469
|
+
|
|
470
|
+
// Build:frontend command (shortcut)
|
|
471
|
+
cliRegistry.register({
|
|
472
|
+
name: 'build:frontend',
|
|
473
|
+
description: 'Build frontend only (shortcut for build --frontend-only)',
|
|
474
|
+
category: 'Build',
|
|
475
|
+
usage: 'flux build:frontend',
|
|
476
|
+
examples: [
|
|
477
|
+
'flux build:frontend # Build only frontend'
|
|
478
|
+
],
|
|
479
|
+
handler: async (args, options, context) => {
|
|
480
|
+
const config = getConfigSync()
|
|
481
|
+
const builder = new FluxStackBuilder(config)
|
|
482
|
+
await builder.buildClient()
|
|
483
|
+
}
|
|
484
|
+
})
|
|
485
|
+
|
|
486
|
+
// Build:backend command (shortcut)
|
|
487
|
+
cliRegistry.register({
|
|
488
|
+
name: 'build:backend',
|
|
489
|
+
description: 'Build backend only (shortcut for build --backend-only)',
|
|
490
|
+
category: 'Build',
|
|
491
|
+
usage: 'flux build:backend',
|
|
492
|
+
examples: [
|
|
493
|
+
'flux build:backend # Build only backend'
|
|
494
|
+
],
|
|
495
|
+
handler: async (args, options, context) => {
|
|
496
|
+
const config = getConfigSync()
|
|
497
|
+
const builder = new FluxStackBuilder(config)
|
|
498
|
+
await builder.buildServer()
|
|
499
|
+
}
|
|
500
|
+
})
|
|
501
|
+
|
|
502
|
+
// Build:exe command (compile to executable)
|
|
503
|
+
cliRegistry.register({
|
|
504
|
+
name: 'build:exe',
|
|
505
|
+
description: 'Compile application to standalone executable',
|
|
506
|
+
category: 'Build',
|
|
507
|
+
usage: 'flux build:exe [options]',
|
|
508
|
+
examples: [
|
|
509
|
+
'flux build:exe # Compile to CLauncher executable',
|
|
510
|
+
'flux build:exe --name MyApp # Compile with custom name',
|
|
511
|
+
'flux build:exe --windows-title "My Launcher" # Set Windows executable title',
|
|
512
|
+
'flux build:exe --windows-hide-console # Hide console window on Windows'
|
|
513
|
+
],
|
|
514
|
+
options: [
|
|
515
|
+
{
|
|
516
|
+
name: 'name',
|
|
517
|
+
short: 'n',
|
|
518
|
+
description: 'Name for the executable file',
|
|
519
|
+
type: 'string',
|
|
520
|
+
default: 'CLauncher'
|
|
521
|
+
},
|
|
522
|
+
{
|
|
523
|
+
name: 'windows-hide-console',
|
|
524
|
+
description: 'Hide console window on Windows',
|
|
525
|
+
type: 'boolean',
|
|
526
|
+
default: false
|
|
527
|
+
},
|
|
528
|
+
{
|
|
529
|
+
name: 'windows-icon',
|
|
530
|
+
description: 'Path to .ico file for Windows executable',
|
|
531
|
+
type: 'string'
|
|
532
|
+
},
|
|
533
|
+
{
|
|
534
|
+
name: 'windows-title',
|
|
535
|
+
description: 'Product name for Windows executable',
|
|
536
|
+
type: 'string'
|
|
537
|
+
},
|
|
538
|
+
{
|
|
539
|
+
name: 'windows-publisher',
|
|
540
|
+
description: 'Company name for Windows executable',
|
|
541
|
+
type: 'string'
|
|
542
|
+
},
|
|
543
|
+
{
|
|
544
|
+
name: 'windows-version',
|
|
545
|
+
description: 'Version string for Windows executable (e.g. 1.2.3.4)',
|
|
546
|
+
type: 'string'
|
|
547
|
+
},
|
|
548
|
+
{
|
|
549
|
+
name: 'windows-description',
|
|
550
|
+
description: 'Description for Windows executable',
|
|
551
|
+
type: 'string'
|
|
552
|
+
},
|
|
553
|
+
{
|
|
554
|
+
name: 'windows-copyright',
|
|
555
|
+
description: 'Copyright string for Windows executable',
|
|
556
|
+
type: 'string'
|
|
557
|
+
}
|
|
558
|
+
],
|
|
559
|
+
handler: async (args, options, context) => {
|
|
560
|
+
const config = getConfigSync()
|
|
561
|
+
const builder = new FluxStackBuilder(config)
|
|
562
|
+
|
|
563
|
+
// Build executable options from CLI args
|
|
564
|
+
const executableOptions: import("../types/build").BundleOptions = {
|
|
565
|
+
executable: {
|
|
566
|
+
windows: {
|
|
567
|
+
hideConsole: options['windows-hide-console'],
|
|
568
|
+
icon: options['windows-icon'],
|
|
569
|
+
title: options['windows-title'],
|
|
570
|
+
publisher: options['windows-publisher'],
|
|
571
|
+
version: options['windows-version'],
|
|
572
|
+
description: options['windows-description'],
|
|
573
|
+
copyright: options['windows-copyright']
|
|
574
|
+
}
|
|
575
|
+
}
|
|
576
|
+
}
|
|
577
|
+
|
|
578
|
+
const result = await builder.buildExecutable(options.name, executableOptions)
|
|
579
|
+
|
|
580
|
+
if (result.success) {
|
|
581
|
+
console.log(`\n✅ Executable created successfully: ${result.outputPath}`)
|
|
582
|
+
|
|
583
|
+
// Show applied Windows options
|
|
584
|
+
if (process.platform === 'win32' && Object.values(executableOptions.executable?.windows || {}).some(v => v)) {
|
|
585
|
+
console.log('\n📦 Windows executable options applied:')
|
|
586
|
+
const winOpts = executableOptions.executable?.windows
|
|
587
|
+
if (winOpts?.hideConsole) console.log(' • Console window hidden')
|
|
588
|
+
if (winOpts?.icon) console.log(` • Icon: ${winOpts.icon}`)
|
|
589
|
+
if (winOpts?.title) console.log(` • Title: ${winOpts.title}`)
|
|
590
|
+
if (winOpts?.publisher) console.log(` • Publisher: ${winOpts.publisher}`)
|
|
591
|
+
if (winOpts?.version) console.log(` • Version: ${winOpts.version}`)
|
|
592
|
+
if (winOpts?.description) console.log(` • Description: ${winOpts.description}`)
|
|
593
|
+
if (winOpts?.copyright) console.log(` • Copyright: ${winOpts.copyright}`)
|
|
594
|
+
}
|
|
595
|
+
} else {
|
|
596
|
+
console.error(`\n❌ Compilation failed: ${result.error}`)
|
|
597
|
+
process.exit(1)
|
|
598
|
+
}
|
|
599
|
+
}
|
|
600
|
+
})
|
|
359
601
|
}
|
|
360
602
|
|
|
361
603
|
// Main CLI logic
|
|
@@ -378,189 +620,12 @@ async function main() {
|
|
|
378
620
|
process.exit(exitCode)
|
|
379
621
|
return
|
|
380
622
|
}
|
|
381
|
-
|
|
382
|
-
// Fallback to legacy command handling for backward compatibility
|
|
383
|
-
await handleLegacyCommands()
|
|
384
|
-
}
|
|
385
|
-
|
|
386
|
-
// Legacy command handling for backward compatibility
|
|
387
|
-
async function handleLegacyCommands() {
|
|
388
|
-
switch (command) {
|
|
389
|
-
case "dev":
|
|
390
|
-
// Grouped startup messages
|
|
391
|
-
startGroup({
|
|
392
|
-
title: 'FluxStack Development Server',
|
|
393
|
-
icon: '⚡',
|
|
394
|
-
color: 'cyan'
|
|
395
|
-
})
|
|
396
|
-
|
|
397
|
-
logInGroup('Frontend: http://localhost:5173', '🌐')
|
|
398
|
-
logInGroup('Backend: http://localhost:3000', '🚀')
|
|
399
|
-
logInGroup('Backend inicia Vite programaticamente', '🔄')
|
|
400
|
-
logInGroup('Starting backend server...', '📦')
|
|
401
|
-
|
|
402
|
-
endGroup()
|
|
403
|
-
console.log('') // Separator line
|
|
404
|
-
|
|
405
|
-
// Start only backend - it will start Vite programmatically
|
|
406
|
-
const { spawn } = await import("child_process")
|
|
407
|
-
const devProcess = spawn("bun", ["--watch", "app/server/index.ts"], {
|
|
408
|
-
stdio: "inherit",
|
|
409
|
-
cwd: process.cwd()
|
|
410
|
-
})
|
|
411
|
-
|
|
412
|
-
// Handle process cleanup
|
|
413
|
-
process.on('SIGINT', () => {
|
|
414
|
-
console.log('\n🛑 Shutting down gracefully...')
|
|
415
|
-
devProcess.kill('SIGTERM')
|
|
416
|
-
setTimeout(() => {
|
|
417
|
-
devProcess.kill('SIGKILL')
|
|
418
|
-
process.exit(0)
|
|
419
|
-
}, 5000)
|
|
420
|
-
})
|
|
421
|
-
|
|
422
|
-
devProcess.on('close', (code) => {
|
|
423
|
-
process.exit(code || 0)
|
|
424
|
-
})
|
|
425
|
-
|
|
426
|
-
// Keep the CLI running until the child process exits
|
|
427
|
-
await new Promise((resolve) => {
|
|
428
|
-
devProcess.on('exit', resolve)
|
|
429
|
-
})
|
|
430
|
-
break
|
|
431
|
-
|
|
432
|
-
case "frontend":
|
|
433
|
-
console.log("🎨 FluxStack Frontend Development")
|
|
434
|
-
console.log("🌐 Frontend: http://localhost:5173")
|
|
435
|
-
console.log("📦 Starting Vite dev server...")
|
|
436
|
-
console.log()
|
|
437
|
-
|
|
438
|
-
const { spawn: spawnFrontend } = await import("child_process")
|
|
439
|
-
const frontendProcess = spawnFrontend("vite", ["--config", "vite.config.ts"], {
|
|
440
|
-
stdio: "inherit",
|
|
441
|
-
cwd: process.cwd()
|
|
442
|
-
})
|
|
443
|
-
|
|
444
|
-
process.on('SIGINT', () => {
|
|
445
|
-
frontendProcess.kill('SIGINT')
|
|
446
|
-
process.exit(0)
|
|
447
|
-
})
|
|
448
|
-
break
|
|
449
|
-
|
|
450
|
-
case "backend":
|
|
451
|
-
console.log("⚡ FluxStack Backend Development")
|
|
452
|
-
console.log("🚀 API Server: http://localhost:3001")
|
|
453
|
-
console.log("📦 Starting backend with hot reload...")
|
|
454
|
-
console.log()
|
|
455
|
-
|
|
456
|
-
// Ensure backend-only.ts exists
|
|
457
|
-
const { ensureBackendEntry } = await import("../utils/regenerate-files")
|
|
458
|
-
await ensureBackendEntry()
|
|
459
|
-
|
|
460
|
-
// Start backend with Bun watch for hot reload
|
|
461
|
-
const { spawn: spawnBackend } = await import("child_process")
|
|
462
|
-
const backendProcess = spawnBackend("bun", ["--watch", "app/server/backend-only.ts"], {
|
|
463
|
-
stdio: "inherit",
|
|
464
|
-
cwd: process.cwd()
|
|
465
|
-
})
|
|
466
|
-
|
|
467
|
-
// Handle process cleanup
|
|
468
|
-
process.on('SIGINT', () => {
|
|
469
|
-
backendProcess.kill('SIGINT')
|
|
470
|
-
process.exit(0)
|
|
471
|
-
})
|
|
472
|
-
break
|
|
473
|
-
|
|
474
|
-
case "build":
|
|
475
|
-
const config = getConfigSync()
|
|
476
|
-
const builder = new FluxStackBuilder(config)
|
|
477
|
-
await builder.build()
|
|
478
|
-
break
|
|
479
|
-
|
|
480
|
-
case "build:frontend":
|
|
481
|
-
const frontendConfig = getConfigSync()
|
|
482
|
-
const frontendBuilder = new FluxStackBuilder(frontendConfig)
|
|
483
|
-
await frontendBuilder.buildClient()
|
|
484
|
-
break
|
|
485
|
-
|
|
486
|
-
case "build:backend":
|
|
487
|
-
const backendConfig = getConfigSync()
|
|
488
|
-
const backendBuilder = new FluxStackBuilder(backendConfig)
|
|
489
|
-
await backendBuilder.buildServer()
|
|
490
|
-
break
|
|
491
|
-
|
|
492
|
-
case "start":
|
|
493
|
-
console.log("🚀 Starting FluxStack production server...")
|
|
494
|
-
const { join } = await import("path")
|
|
495
|
-
await import(join(process.cwd(), "dist", "index.js"))
|
|
496
|
-
break
|
|
497
|
-
|
|
498
|
-
case "create":
|
|
499
|
-
const projectName = process.argv[3]
|
|
500
|
-
const template = process.argv[4]
|
|
501
|
-
|
|
502
|
-
if (!projectName) {
|
|
503
|
-
console.error("❌ Please provide a project name: flux create my-app")
|
|
504
|
-
console.error()
|
|
505
|
-
console.error("Usage:")
|
|
506
|
-
console.error(" flux create <project-name> [template]")
|
|
507
|
-
console.error()
|
|
508
|
-
console.error("Templates:")
|
|
509
|
-
console.error(" basic Basic FluxStack project (default)")
|
|
510
|
-
console.error(" full Full-featured project with examples")
|
|
511
|
-
process.exit(1)
|
|
512
|
-
}
|
|
513
|
-
|
|
514
|
-
// Validate project name
|
|
515
|
-
if (!/^[a-zA-Z0-9-_]+$/.test(projectName)) {
|
|
516
|
-
console.error("❌ Project name can only contain letters, numbers, hyphens, and underscores")
|
|
517
|
-
process.exit(1)
|
|
518
|
-
}
|
|
519
|
-
|
|
520
|
-
try {
|
|
521
|
-
const creator = new ProjectCreator({
|
|
522
|
-
name: projectName,
|
|
523
|
-
template: template as 'basic' | 'full' || 'basic'
|
|
524
|
-
})
|
|
525
|
-
|
|
526
|
-
await creator.create()
|
|
527
|
-
} catch (error) {
|
|
528
|
-
console.error("❌ Failed to create project:", error instanceof Error ? error.message : String(error))
|
|
529
|
-
process.exit(1)
|
|
530
|
-
}
|
|
531
|
-
break
|
|
532
623
|
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
flux dev Start full-stack development server
|
|
539
|
-
flux frontend Start frontend only (Vite dev server)
|
|
540
|
-
flux backend Start backend only (API server)
|
|
541
|
-
flux build Build both frontend and backend
|
|
542
|
-
flux build:frontend Build frontend only
|
|
543
|
-
flux build:backend Build backend only
|
|
544
|
-
flux start Start production server
|
|
545
|
-
flux create Create new project
|
|
546
|
-
|
|
547
|
-
Examples:
|
|
548
|
-
flux dev # Full-stack development
|
|
549
|
-
flux frontend # Frontend only (port 5173)
|
|
550
|
-
flux backend # Backend only (port 3001)
|
|
551
|
-
flux create my-app # Create new project
|
|
552
|
-
|
|
553
|
-
Alternative commands:
|
|
554
|
-
fluxstack dev # Same as flux dev
|
|
555
|
-
bun run dev:frontend # Direct frontend start
|
|
556
|
-
bun run dev:backend # Direct backend start
|
|
557
|
-
|
|
558
|
-
Environment Variables:
|
|
559
|
-
FRONTEND_PORT=5173 # Frontend port
|
|
560
|
-
BACKEND_PORT=3001 # Backend port
|
|
561
|
-
API_URL=http://localhost:3001 # API URL for frontend
|
|
562
|
-
`)
|
|
563
|
-
}
|
|
624
|
+
// Command not found - show error and help
|
|
625
|
+
console.error(`❌ Unknown command: ${command}`)
|
|
626
|
+
console.error()
|
|
627
|
+
await cliRegistry.execute('help', args)
|
|
628
|
+
process.exit(1)
|
|
564
629
|
}
|
|
565
630
|
|
|
566
631
|
// Run main CLI
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { existsSync } from 'fs'
|
|
2
2
|
import { join } from 'path'
|
|
3
|
-
import type { FluxStack } from '
|
|
3
|
+
import type { FluxStack } from '@/core/plugins/types'
|
|
4
4
|
import { cliRegistry } from './command-registry'
|
|
5
|
-
import { logger } from '
|
|
5
|
+
import { logger } from '@/core/utils/logger'
|
|
6
6
|
|
|
7
7
|
export class CliPluginDiscovery {
|
|
8
8
|
private loadedPlugins = new Set<string>()
|
|
@@ -110,7 +110,7 @@ export class CliPluginDiscovery {
|
|
|
110
110
|
}
|
|
111
111
|
}
|
|
112
112
|
|
|
113
|
-
private registerPluginCommands(plugin: Plugin): void {
|
|
113
|
+
private registerPluginCommands(plugin: FluxStack.Plugin): void {
|
|
114
114
|
if (!plugin.commands || this.loadedPlugins.has(plugin.name)) {
|
|
115
115
|
return
|
|
116
116
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// 🔥 WebSocket Hook for Live Components
|
|
2
2
|
|
|
3
3
|
import { useState, useEffect, useCallback, useRef } from 'react'
|
|
4
|
-
import type { WebSocketMessage, WebSocketResponse } from '
|
|
4
|
+
import type { WebSocketMessage, WebSocketResponse } from '@/core/types/types'
|
|
5
5
|
|
|
6
6
|
// Re-export types for easier importing
|
|
7
7
|
export type { WebSocketMessage, WebSocketResponse }
|
package/core/config/env.ts
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Handles environment variable processing and precedence
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import { env, helpers } from '
|
|
6
|
+
import { env, helpers } from '@/core/utils/env'
|
|
7
7
|
import type { FluxStackConfig, LogLevel, BuildTarget, LogFormat } from './schema'
|
|
8
8
|
|
|
9
9
|
export interface EnvironmentInfo {
|
|
@@ -6,11 +6,11 @@
|
|
|
6
6
|
import { env, createNamespace } from '../utils/env'
|
|
7
7
|
import type { FluxStackConfig } from './schema'
|
|
8
8
|
import { defaultFluxStackConfig } from './schema'
|
|
9
|
-
import { loggerConfig } from '
|
|
10
|
-
import { clientConfig } from '
|
|
11
|
-
import { serverConfig } from '
|
|
12
|
-
import { monitoringConfig } from '
|
|
13
|
-
import { appConfig } from '
|
|
9
|
+
import { loggerConfig } from '@/config/logger.config'
|
|
10
|
+
import { clientConfig } from '@/config/client.config'
|
|
11
|
+
import { serverConfig } from '@/config/server.config'
|
|
12
|
+
import { monitoringConfig } from '@/config/monitoring.config'
|
|
13
|
+
import { appConfig } from '@/config/app.config'
|
|
14
14
|
|
|
15
15
|
/**
|
|
16
16
|
* Runtime Configuration Builder
|
package/core/config/schema.ts
CHANGED
|
@@ -209,6 +209,15 @@ export interface FluxStackConfig {
|
|
|
209
209
|
auth?: AuthConfig
|
|
210
210
|
email?: EmailConfig
|
|
211
211
|
storage?: StorageConfig
|
|
212
|
+
staticFiles?: {
|
|
213
|
+
publicDir?: string
|
|
214
|
+
uploadsDir?: string
|
|
215
|
+
cacheMaxAge?: number
|
|
216
|
+
enableUploads?: boolean
|
|
217
|
+
enablePublic?: boolean
|
|
218
|
+
publicRoute?: string
|
|
219
|
+
uploadsRoute?: string
|
|
220
|
+
}
|
|
212
221
|
|
|
213
222
|
// Environment-specific overrides
|
|
214
223
|
environments?: {
|