create-fluxstack 1.0.0 → 1.0.2

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.
Files changed (101) hide show
  1. package/create-fluxstack.ts +32 -17
  2. package/package-template.json +51 -0
  3. package/package.json +2 -1
  4. package/.env +0 -30
  5. package/LICENSE +0 -21
  6. package/app/client/README.md +0 -69
  7. package/app/client/frontend-only.ts +0 -12
  8. package/app/client/index.html +0 -13
  9. package/app/client/public/vite.svg +0 -1
  10. package/app/client/src/App.css +0 -883
  11. package/app/client/src/App.tsx +0 -669
  12. package/app/client/src/assets/react.svg +0 -1
  13. package/app/client/src/components/TestPage.tsx +0 -453
  14. package/app/client/src/index.css +0 -51
  15. package/app/client/src/lib/eden-api.ts +0 -110
  16. package/app/client/src/main.tsx +0 -10
  17. package/app/client/src/vite-env.d.ts +0 -1
  18. package/app/client/tsconfig.app.json +0 -43
  19. package/app/client/tsconfig.json +0 -7
  20. package/app/client/tsconfig.node.json +0 -25
  21. package/app/server/app.ts +0 -10
  22. package/app/server/backend-only.ts +0 -15
  23. package/app/server/controllers/users.controller.ts +0 -69
  24. package/app/server/index.ts +0 -104
  25. package/app/server/routes/index.ts +0 -25
  26. package/app/server/routes/users.routes.ts +0 -121
  27. package/app/server/types/index.ts +0 -1
  28. package/app/shared/types/index.ts +0 -18
  29. package/bun.lock +0 -1053
  30. package/core/__tests__/integration.test.ts +0 -227
  31. package/core/build/index.ts +0 -186
  32. package/core/cli/command-registry.ts +0 -334
  33. package/core/cli/index.ts +0 -394
  34. package/core/cli/plugin-discovery.ts +0 -200
  35. package/core/client/standalone.ts +0 -57
  36. package/core/config/__tests__/config-loader.test.ts +0 -591
  37. package/core/config/__tests__/config-merger.test.ts +0 -657
  38. package/core/config/__tests__/env-converter.test.ts +0 -372
  39. package/core/config/__tests__/env-processor.test.ts +0 -431
  40. package/core/config/__tests__/env.test.ts +0 -452
  41. package/core/config/__tests__/integration.test.ts +0 -418
  42. package/core/config/__tests__/loader.test.ts +0 -331
  43. package/core/config/__tests__/schema.test.ts +0 -129
  44. package/core/config/__tests__/validator.test.ts +0 -318
  45. package/core/config/env-dynamic.ts +0 -326
  46. package/core/config/env.ts +0 -597
  47. package/core/config/index.ts +0 -317
  48. package/core/config/loader.ts +0 -546
  49. package/core/config/runtime-config.ts +0 -322
  50. package/core/config/schema.ts +0 -694
  51. package/core/config/validator.ts +0 -540
  52. package/core/framework/__tests__/server.test.ts +0 -233
  53. package/core/framework/client.ts +0 -132
  54. package/core/framework/index.ts +0 -8
  55. package/core/framework/server.ts +0 -501
  56. package/core/framework/types.ts +0 -63
  57. package/core/plugins/__tests__/built-in.test.ts.disabled +0 -366
  58. package/core/plugins/__tests__/manager.test.ts +0 -398
  59. package/core/plugins/__tests__/monitoring.test.ts +0 -401
  60. package/core/plugins/__tests__/registry.test.ts +0 -335
  61. package/core/plugins/built-in/index.ts +0 -142
  62. package/core/plugins/built-in/logger/index.ts +0 -180
  63. package/core/plugins/built-in/monitoring/README.md +0 -193
  64. package/core/plugins/built-in/monitoring/index.ts +0 -912
  65. package/core/plugins/built-in/static/index.ts +0 -289
  66. package/core/plugins/built-in/swagger/index.ts +0 -229
  67. package/core/plugins/built-in/vite/index.ts +0 -316
  68. package/core/plugins/config.ts +0 -348
  69. package/core/plugins/discovery.ts +0 -350
  70. package/core/plugins/executor.ts +0 -351
  71. package/core/plugins/index.ts +0 -195
  72. package/core/plugins/manager.ts +0 -583
  73. package/core/plugins/registry.ts +0 -424
  74. package/core/plugins/types.ts +0 -254
  75. package/core/server/framework.ts +0 -123
  76. package/core/server/index.ts +0 -8
  77. package/core/server/plugins/database.ts +0 -182
  78. package/core/server/plugins/logger.ts +0 -47
  79. package/core/server/plugins/swagger.ts +0 -34
  80. package/core/server/standalone.ts +0 -91
  81. package/core/templates/create-project.ts +0 -455
  82. package/core/types/api.ts +0 -169
  83. package/core/types/build.ts +0 -174
  84. package/core/types/config.ts +0 -68
  85. package/core/types/index.ts +0 -127
  86. package/core/types/plugin.ts +0 -94
  87. package/core/utils/__tests__/errors.test.ts +0 -139
  88. package/core/utils/__tests__/helpers.test.ts +0 -297
  89. package/core/utils/__tests__/logger.test.ts +0 -141
  90. package/core/utils/env-runtime-v2.ts +0 -232
  91. package/core/utils/env-runtime.ts +0 -252
  92. package/core/utils/errors/codes.ts +0 -115
  93. package/core/utils/errors/handlers.ts +0 -63
  94. package/core/utils/errors/index.ts +0 -81
  95. package/core/utils/helpers.ts +0 -180
  96. package/core/utils/index.ts +0 -18
  97. package/core/utils/logger/index.ts +0 -161
  98. package/core/utils/logger.ts +0 -106
  99. package/core/utils/monitoring/index.ts +0 -212
  100. package/tsconfig.json +0 -51
  101. package/vite.config.ts +0 -42
@@ -1,317 +0,0 @@
1
- /**
2
- * FluxStack Configuration System
3
- * Unified interface for configuration loading, validation, and management
4
- */
5
-
6
- // Re-export all configuration types and utilities
7
- export type {
8
- FluxStackConfig,
9
- AppConfig,
10
- ServerConfig,
11
- ClientConfig,
12
- BuildConfig,
13
- LoggingConfig,
14
- MonitoringConfig,
15
- PluginConfig,
16
- DatabaseConfig,
17
- AuthConfig,
18
- EmailConfig,
19
- StorageConfig,
20
- LogLevel,
21
- BuildTarget,
22
- LogFormat
23
- } from './schema'
24
-
25
- export {
26
- defaultFluxStackConfig,
27
- environmentDefaults,
28
- fluxStackConfigSchema
29
- } from './schema'
30
-
31
- export interface ConfigLoadOptions {
32
- configPath?: string
33
- environment?: string
34
- envPrefix?: string
35
- validateSchema?: boolean
36
- }
37
-
38
- export interface ConfigLoadResult {
39
- config: FluxStackConfig
40
- sources: string[]
41
- warnings: string[]
42
- errors: string[]
43
- }
44
-
45
- import {
46
- loadConfig as _loadConfig,
47
- loadConfigSync as _loadConfigSync,
48
- getConfigValue,
49
- hasConfigValue,
50
- createConfigSubset
51
- } from './loader'
52
-
53
- import { environmentDefaults } from './schema'
54
-
55
- export {
56
- _loadConfig as loadConfig,
57
- _loadConfigSync as loadConfigSync,
58
- getConfigValue,
59
- hasConfigValue,
60
- createConfigSubset
61
- }
62
-
63
- export type {
64
- ValidationResult,
65
- ValidationError,
66
- ValidationWarning
67
- } from './validator'
68
-
69
- export {
70
- validateConfig,
71
- validateConfigStrict,
72
- createEnvironmentValidator,
73
- validatePartialConfig,
74
- getConfigSuggestions
75
- } from './validator'
76
-
77
- export type {
78
- EnvironmentInfo,
79
- ConfigPrecedence
80
- } from './env'
81
-
82
- export {
83
- getEnvironmentInfo,
84
- EnvConverter,
85
- EnvironmentProcessor,
86
- ConfigMerger,
87
- EnvironmentConfigApplier,
88
- environmentProcessor,
89
- configMerger,
90
- environmentConfigApplier,
91
- isDevelopment,
92
- isProduction,
93
- isTest,
94
- getEnvironmentRecommendations
95
- } from './env'
96
-
97
- // Main configuration loader with caching
98
- let cachedConfig: FluxStackConfig | null = null
99
- let configPromise: Promise<FluxStackConfig> | null = null
100
-
101
- /**
102
- * Get the current FluxStack configuration
103
- * This function loads and caches the configuration on first call
104
- */
105
- export async function getConfig(options?: ConfigLoadOptions): Promise<FluxStackConfig> {
106
- if (cachedConfig && !options) {
107
- return cachedConfig
108
- }
109
-
110
- if (configPromise && !options) {
111
- return configPromise
112
- }
113
-
114
- configPromise = loadConfiguration(options)
115
- cachedConfig = await configPromise
116
-
117
- return cachedConfig
118
- }
119
-
120
- /**
121
- * Get configuration synchronously (limited functionality)
122
- * Only loads from environment variables and defaults
123
- */
124
- export function getConfigSync(options?: ConfigLoadOptions): FluxStackConfig {
125
- const result = _loadConfigSync(options)
126
-
127
- if (result.errors.length > 0) {
128
- console.warn('Configuration errors:', result.errors)
129
- }
130
-
131
- if (result.warnings.length > 0) {
132
- console.warn('Configuration warnings:', result.warnings)
133
- }
134
-
135
- return result.config
136
- }
137
-
138
- /**
139
- * Reload configuration (clears cache)
140
- */
141
- export async function reloadConfig(options?: ConfigLoadOptions): Promise<FluxStackConfig> {
142
- cachedConfig = null
143
- configPromise = null
144
- return getConfig(options)
145
- }
146
-
147
- /**
148
- * Internal configuration loader with error handling
149
- */
150
- async function loadConfiguration(options?: ConfigLoadOptions): Promise<FluxStackConfig> {
151
- try {
152
- const result = await _loadConfig(options)
153
-
154
- // Log warnings if any
155
- if (result.warnings.length > 0) {
156
- console.warn('Configuration warnings:')
157
- result.warnings.forEach(warning => console.warn(` - ${warning}`))
158
- }
159
-
160
- // Throw on errors
161
- if (result.errors.length > 0) {
162
- const errorMessage = [
163
- 'Configuration loading failed:',
164
- ...result.errors.map(e => ` - ${e}`)
165
- ].join('\n')
166
-
167
- throw new Error(errorMessage)
168
- }
169
-
170
- return result.config
171
- } catch (error) {
172
- console.error('Failed to load FluxStack configuration:', error)
173
-
174
- // Fall back to default configuration with environment variables and environment defaults
175
- const fallbackResult = _loadConfigSync(options)
176
- console.warn('Using fallback configuration with environment variables only')
177
-
178
- // Apply environment defaults to fallback configuration
179
- const environment = process.env.NODE_ENV || 'development'
180
- const envDefaults = environmentDefaults[environment as keyof typeof environmentDefaults]
181
-
182
- if (envDefaults) {
183
- // Simple merge for fallback with proper type casting
184
- const configWithDefaults = {
185
- ...fallbackResult.config,
186
- logging: {
187
- ...fallbackResult.config.logging,
188
- ...((envDefaults as any).logging || {})
189
- },
190
- server: (envDefaults as any).server ? {
191
- ...fallbackResult.config.server,
192
- ...(envDefaults as any).server
193
- } : fallbackResult.config.server,
194
- client: (envDefaults as any).client ? {
195
- ...fallbackResult.config.client,
196
- ...(envDefaults as any).client
197
- } : fallbackResult.config.client,
198
- build: (envDefaults as any).build ? {
199
- ...fallbackResult.config.build,
200
- optimization: {
201
- ...fallbackResult.config.build.optimization,
202
- ...((envDefaults as any).build.optimization || {})
203
- }
204
- } : fallbackResult.config.build,
205
- monitoring: (envDefaults as any).monitoring ? {
206
- ...fallbackResult.config.monitoring,
207
- ...(envDefaults as any).monitoring
208
- } : fallbackResult.config.monitoring
209
- } as FluxStackConfig
210
- return configWithDefaults
211
- }
212
-
213
- return fallbackResult.config
214
- }
215
- }
216
-
217
- /**
218
- * Create a configuration subset for plugins or modules
219
- */
220
- export function createPluginConfig<T = any>(
221
- config: FluxStackConfig,
222
- pluginName: string
223
- ): T {
224
- const pluginConfig = config.plugins.config[pluginName] || {}
225
- const customConfig = config.custom?.[pluginName] || {}
226
-
227
- return { ...pluginConfig, ...customConfig } as T
228
- }
229
-
230
- /**
231
- * Check if a feature is enabled based on configuration
232
- */
233
- export function isFeatureEnabled(config: FluxStackConfig, feature: string): boolean {
234
- // Check plugin configuration
235
- if (config.plugins.enabled.includes(feature)) {
236
- return !config.plugins.disabled.includes(feature)
237
- }
238
-
239
- // Check monitoring features
240
- if (feature === 'monitoring') {
241
- return config.monitoring.enabled
242
- }
243
-
244
- if (feature === 'metrics') {
245
- return config.monitoring.enabled && config.monitoring.metrics.enabled
246
- }
247
-
248
- if (feature === 'profiling') {
249
- return config.monitoring.enabled && config.monitoring.profiling.enabled
250
- }
251
-
252
- // Check custom features
253
- return config.custom?.[feature] === true
254
- }
255
-
256
- /**
257
- * Get database configuration if available
258
- */
259
- export function getDatabaseConfig(config: FluxStackConfig) {
260
- return config.database || null
261
- }
262
-
263
- /**
264
- * Get authentication configuration if available
265
- */
266
- export function getAuthConfig(config: FluxStackConfig) {
267
- return config.auth || null
268
- }
269
-
270
- /**
271
- * Get email configuration if available
272
- */
273
- export function getEmailConfig(config: FluxStackConfig) {
274
- return config.email || null
275
- }
276
-
277
- /**
278
- * Get storage configuration if available
279
- */
280
- export function getStorageConfig(config: FluxStackConfig) {
281
- return config.storage || null
282
- }
283
-
284
- /**
285
- * Backward compatibility function for legacy configuration
286
- */
287
- export function createLegacyConfig(config: FluxStackConfig) {
288
- return {
289
- port: config.server.port,
290
- vitePort: config.client.port,
291
- clientPath: 'app/client', // Fixed path for backward compatibility
292
- apiPrefix: config.server.apiPrefix,
293
- cors: {
294
- origins: config.server.cors.origins,
295
- methods: config.server.cors.methods,
296
- headers: config.server.cors.headers
297
- },
298
- build: {
299
- outDir: config.build.outDir,
300
- target: config.build.target
301
- }
302
- }
303
- }
304
-
305
- /**
306
- * Environment configuration utilities
307
- */
308
- import { getEnvironmentInfo as _getEnvironmentInfo } from './env'
309
- import type { FluxStackConfig } from './schema'
310
-
311
- export const env = {
312
- isDevelopment: () => _getEnvironmentInfo().isDevelopment,
313
- isProduction: () => _getEnvironmentInfo().isProduction,
314
- isTest: () => _getEnvironmentInfo().isTest,
315
- getName: () => _getEnvironmentInfo().name,
316
- getInfo: () => _getEnvironmentInfo()
317
- }