create-fluxstack 1.0.1 → 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 (100) hide show
  1. package/create-fluxstack.ts +2 -3
  2. package/package.json +1 -1
  3. package/.env +0 -30
  4. package/LICENSE +0 -21
  5. package/app/client/README.md +0 -69
  6. package/app/client/frontend-only.ts +0 -12
  7. package/app/client/index.html +0 -13
  8. package/app/client/public/vite.svg +0 -1
  9. package/app/client/src/App.css +0 -883
  10. package/app/client/src/App.tsx +0 -669
  11. package/app/client/src/assets/react.svg +0 -1
  12. package/app/client/src/components/TestPage.tsx +0 -453
  13. package/app/client/src/index.css +0 -51
  14. package/app/client/src/lib/eden-api.ts +0 -110
  15. package/app/client/src/main.tsx +0 -10
  16. package/app/client/src/vite-env.d.ts +0 -1
  17. package/app/client/tsconfig.app.json +0 -43
  18. package/app/client/tsconfig.json +0 -7
  19. package/app/client/tsconfig.node.json +0 -25
  20. package/app/server/app.ts +0 -10
  21. package/app/server/backend-only.ts +0 -15
  22. package/app/server/controllers/users.controller.ts +0 -69
  23. package/app/server/index.ts +0 -104
  24. package/app/server/routes/index.ts +0 -25
  25. package/app/server/routes/users.routes.ts +0 -121
  26. package/app/server/types/index.ts +0 -1
  27. package/app/shared/types/index.ts +0 -18
  28. package/bun.lock +0 -1053
  29. package/core/__tests__/integration.test.ts +0 -227
  30. package/core/build/index.ts +0 -186
  31. package/core/cli/command-registry.ts +0 -334
  32. package/core/cli/index.ts +0 -394
  33. package/core/cli/plugin-discovery.ts +0 -200
  34. package/core/client/standalone.ts +0 -57
  35. package/core/config/__tests__/config-loader.test.ts +0 -591
  36. package/core/config/__tests__/config-merger.test.ts +0 -657
  37. package/core/config/__tests__/env-converter.test.ts +0 -372
  38. package/core/config/__tests__/env-processor.test.ts +0 -431
  39. package/core/config/__tests__/env.test.ts +0 -452
  40. package/core/config/__tests__/integration.test.ts +0 -418
  41. package/core/config/__tests__/loader.test.ts +0 -331
  42. package/core/config/__tests__/schema.test.ts +0 -129
  43. package/core/config/__tests__/validator.test.ts +0 -318
  44. package/core/config/env-dynamic.ts +0 -326
  45. package/core/config/env.ts +0 -597
  46. package/core/config/index.ts +0 -317
  47. package/core/config/loader.ts +0 -546
  48. package/core/config/runtime-config.ts +0 -322
  49. package/core/config/schema.ts +0 -694
  50. package/core/config/validator.ts +0 -540
  51. package/core/framework/__tests__/server.test.ts +0 -233
  52. package/core/framework/client.ts +0 -132
  53. package/core/framework/index.ts +0 -8
  54. package/core/framework/server.ts +0 -501
  55. package/core/framework/types.ts +0 -63
  56. package/core/plugins/__tests__/built-in.test.ts.disabled +0 -366
  57. package/core/plugins/__tests__/manager.test.ts +0 -398
  58. package/core/plugins/__tests__/monitoring.test.ts +0 -401
  59. package/core/plugins/__tests__/registry.test.ts +0 -335
  60. package/core/plugins/built-in/index.ts +0 -142
  61. package/core/plugins/built-in/logger/index.ts +0 -180
  62. package/core/plugins/built-in/monitoring/README.md +0 -193
  63. package/core/plugins/built-in/monitoring/index.ts +0 -912
  64. package/core/plugins/built-in/static/index.ts +0 -289
  65. package/core/plugins/built-in/swagger/index.ts +0 -229
  66. package/core/plugins/built-in/vite/index.ts +0 -316
  67. package/core/plugins/config.ts +0 -348
  68. package/core/plugins/discovery.ts +0 -350
  69. package/core/plugins/executor.ts +0 -351
  70. package/core/plugins/index.ts +0 -195
  71. package/core/plugins/manager.ts +0 -583
  72. package/core/plugins/registry.ts +0 -424
  73. package/core/plugins/types.ts +0 -254
  74. package/core/server/framework.ts +0 -123
  75. package/core/server/index.ts +0 -8
  76. package/core/server/plugins/database.ts +0 -182
  77. package/core/server/plugins/logger.ts +0 -47
  78. package/core/server/plugins/swagger.ts +0 -34
  79. package/core/server/standalone.ts +0 -91
  80. package/core/templates/create-project.ts +0 -455
  81. package/core/types/api.ts +0 -169
  82. package/core/types/build.ts +0 -174
  83. package/core/types/config.ts +0 -68
  84. package/core/types/index.ts +0 -127
  85. package/core/types/plugin.ts +0 -94
  86. package/core/utils/__tests__/errors.test.ts +0 -139
  87. package/core/utils/__tests__/helpers.test.ts +0 -297
  88. package/core/utils/__tests__/logger.test.ts +0 -141
  89. package/core/utils/env-runtime-v2.ts +0 -232
  90. package/core/utils/env-runtime.ts +0 -252
  91. package/core/utils/errors/codes.ts +0 -115
  92. package/core/utils/errors/handlers.ts +0 -63
  93. package/core/utils/errors/index.ts +0 -81
  94. package/core/utils/helpers.ts +0 -180
  95. package/core/utils/index.ts +0 -18
  96. package/core/utils/logger/index.ts +0 -161
  97. package/core/utils/logger.ts +0 -106
  98. package/core/utils/monitoring/index.ts +0 -212
  99. package/tsconfig.json +0 -51
  100. package/vite.config.ts +0 -42
@@ -1,366 +0,0 @@
1
- /**
2
- * Tests for Built-in Plugins
3
- */
4
-
5
- import { describe, it, expect, beforeEach, vi } from 'vitest'
6
- import {
7
- loggerPlugin,
8
- swaggerPlugin,
9
- vitePlugin,
10
- staticPlugin,
11
- monitoringPlugin,
12
- builtInPlugins,
13
- builtInPluginsList,
14
- getDefaultPlugins,
15
- getBuiltInPlugin,
16
- isBuiltInPlugin
17
- } from '../built-in'
18
- import type { PluginContext, RequestContext, ResponseContext, ErrorContext } from '../types'
19
- import type { Logger } from '../../utils/logger/index'
20
- import type { FluxStackConfig } from '../../config/schema'
21
-
22
- // Mock logger
23
- const mockLogger: Logger = {
24
- debug: vi.fn(),
25
- info: vi.fn(),
26
- warn: vi.fn(),
27
- error: vi.fn(),
28
- child: vi.fn(() => mockLogger),
29
- time: vi.fn(),
30
- timeEnd: vi.fn(),
31
- request: vi.fn()
32
- }
33
-
34
- // Mock app
35
- const mockApp = {
36
- use: vi.fn(),
37
- get: vi.fn(),
38
- post: vi.fn(),
39
- put: vi.fn(),
40
- delete: vi.fn()
41
- }
42
-
43
- // Mock config
44
- const mockConfig: FluxStackConfig = {
45
- app: { name: 'test-app', version: '1.0.0' },
46
- server: {
47
- port: 3000,
48
- host: 'localhost',
49
- apiPrefix: '/api',
50
- cors: {
51
- origins: ['*'],
52
- methods: ['GET', 'POST'],
53
- headers: ['Content-Type']
54
- },
55
- middleware: []
56
- },
57
- client: {
58
- port: 5173,
59
- proxy: { target: 'http://localhost:3000' },
60
- build: {
61
- sourceMaps: true,
62
- minify: false,
63
- target: 'esnext',
64
- outDir: 'dist/client'
65
- }
66
- },
67
- build: {
68
- target: 'bun',
69
- outDir: 'dist',
70
- optimization: {
71
- minify: false,
72
- treeshake: false,
73
- compress: false,
74
- splitChunks: false,
75
- bundleAnalyzer: false
76
- },
77
- sourceMaps: true,
78
- clean: true
79
- },
80
- plugins: {
81
- enabled: [],
82
- disabled: [],
83
- config: {}
84
- },
85
- logging: {
86
- level: 'info',
87
- format: 'pretty',
88
- transports: []
89
- },
90
- monitoring: {
91
- enabled: false,
92
- metrics: {
93
- enabled: false,
94
- collectInterval: 5000,
95
- httpMetrics: false,
96
- systemMetrics: false,
97
- customMetrics: false
98
- },
99
- profiling: {
100
- enabled: false,
101
- sampleRate: 0.1,
102
- memoryProfiling: false,
103
- cpuProfiling: false
104
- },
105
- exporters: []
106
- }
107
- }
108
-
109
- // Mock utils
110
- const mockUtils = {
111
- createTimer: vi.fn(() => ({ end: vi.fn(() => 100) })),
112
- formatBytes: vi.fn((bytes: number) => `${bytes} bytes`),
113
- isProduction: vi.fn(() => false),
114
- isDevelopment: vi.fn(() => true),
115
- getEnvironment: vi.fn(() => 'development'),
116
- createHash: vi.fn(() => 'hash123'),
117
- deepMerge: vi.fn((a, b) => ({ ...a, ...b })),
118
- validateSchema: vi.fn(() => ({ valid: true, errors: [] }))
119
- }
120
-
121
- describe.skip('Built-in Plugins', () => {
122
- let context: PluginContext
123
-
124
- beforeEach(() => {
125
- context = {
126
- config: mockConfig,
127
- logger: mockLogger,
128
- app: mockApp,
129
- utils: mockUtils
130
- }
131
- vi.clearAllMocks()
132
- })
133
-
134
- describe('Plugin Structure', () => {
135
- it('should export all built-in plugins', () => {
136
- expect(builtInPlugins).toBeDefined()
137
- expect(builtInPlugins.logger).toBe(loggerPlugin)
138
- expect(builtInPlugins.swagger).toBe(swaggerPlugin)
139
- expect(builtInPlugins.vite).toBe(vitePlugin)
140
- expect(builtInPlugins.static).toBe(staticPlugin)
141
- expect(builtInPlugins.monitoring).toBe(monitoringPlugin)
142
- })
143
-
144
- it('should export plugins as array', () => {
145
- expect(builtInPluginsList).toHaveLength(5)
146
- expect(builtInPluginsList).toContain(loggerPlugin)
147
- expect(builtInPluginsList).toContain(swaggerPlugin)
148
- expect(builtInPluginsList).toContain(vitePlugin)
149
- expect(builtInPluginsList).toContain(staticPlugin)
150
- expect(builtInPluginsList).toContain(monitoringPlugin)
151
- })
152
-
153
- it('should have valid plugin structure', () => {
154
- for (const plugin of builtInPluginsList) {
155
- expect(plugin.name).toBeDefined()
156
- expect(typeof plugin.name).toBe('string')
157
- expect(plugin.version).toBeDefined()
158
- expect(plugin.description).toBeDefined()
159
- expect(plugin.author).toBeDefined()
160
- expect(plugin.setup).toBeDefined()
161
- expect(typeof plugin.setup).toBe('function')
162
- }
163
- })
164
- })
165
-
166
- describe('Logger Plugin', () => {
167
- it('should have correct metadata', () => {
168
- expect(loggerPlugin.name).toBe('logger')
169
- expect(loggerPlugin.priority).toBe('highest')
170
- expect(loggerPlugin.category).toBe('core')
171
- expect(loggerPlugin.configSchema).toBeDefined()
172
- expect(loggerPlugin.defaultConfig).toBeDefined()
173
- })
174
-
175
- it('should setup successfully', async () => {
176
- await loggerPlugin.setup!(context)
177
- expect(mockLogger.info).toHaveBeenCalledWith(
178
- 'Enhanced logger plugin initialized',
179
- expect.any(Object)
180
- )
181
- })
182
-
183
- it('should handle server start', async () => {
184
- await loggerPlugin.onServerStart!(context)
185
- expect(mockLogger.info).toHaveBeenCalledWith(
186
- 'Logger plugin: Server started',
187
- expect.any(Object)
188
- )
189
- })
190
-
191
- it('should handle server stop', async () => {
192
- await loggerPlugin.onServerStop!(context)
193
- expect(mockLogger.info).toHaveBeenCalledWith('Logger plugin: Server stopped')
194
- })
195
-
196
- it('should handle request logging', async () => {
197
- const requestContext: RequestContext = {
198
- request: new Request('http://localhost:3000/test'),
199
- path: '/test',
200
- method: 'GET',
201
- headers: { 'user-agent': 'test' },
202
- query: {},
203
- params: {},
204
- startTime: Date.now()
205
- }
206
-
207
- await loggerPlugin.onRequest!(requestContext)
208
- // Logger function would be called if available in context
209
- })
210
-
211
- it('should handle response logging', async () => {
212
- const responseContext: ResponseContext = {
213
- request: new Request('http://localhost:3000/test'),
214
- path: '/test',
215
- method: 'GET',
216
- headers: {},
217
- query: {},
218
- params: {},
219
- startTime: Date.now(),
220
- response: new Response('OK'),
221
- statusCode: 200,
222
- duration: 100
223
- }
224
-
225
- await loggerPlugin.onResponse!(responseContext)
226
- // Logger function would be called if available in context
227
- })
228
-
229
- it('should handle error logging', async () => {
230
- const errorContext: ErrorContext = {
231
- request: new Request('http://localhost:3000/test'),
232
- path: '/test',
233
- method: 'GET',
234
- headers: {},
235
- query: {},
236
- params: {},
237
- startTime: Date.now(),
238
- error: new Error('Test error'),
239
- duration: 100,
240
- handled: false
241
- }
242
-
243
- await loggerPlugin.onError!(errorContext)
244
- // Logger function would be called if available in context
245
- })
246
- })
247
-
248
- describe('Swagger Plugin', () => {
249
- it('should have correct metadata', () => {
250
- expect(swaggerPlugin.name).toBe('swagger')
251
- expect(swaggerPlugin.priority).toBe('normal')
252
- expect(swaggerPlugin.category).toBe('documentation')
253
- expect(swaggerPlugin.configSchema).toBeDefined()
254
- expect(swaggerPlugin.defaultConfig).toBeDefined()
255
- })
256
-
257
- it('should setup successfully', async () => {
258
- await swaggerPlugin.setup!(context)
259
- expect(mockApp.use).toHaveBeenCalled()
260
- expect(mockLogger.info).toHaveBeenCalledWith(
261
- expect.stringContaining('Swagger documentation enabled'),
262
- expect.any(Object)
263
- )
264
- })
265
-
266
- it('should handle server start', async () => {
267
- await swaggerPlugin.onServerStart!(context)
268
- expect(mockLogger.info).toHaveBeenCalledWith(
269
- expect.stringContaining('Swagger documentation available')
270
- )
271
- })
272
- })
273
-
274
- describe('Vite Plugin', () => {
275
- it('should have correct metadata', () => {
276
- expect(vitePlugin.name).toBe('vite')
277
- expect(vitePlugin.priority).toBe('high')
278
- expect(vitePlugin.category).toBe('development')
279
- expect(vitePlugin.configSchema).toBeDefined()
280
- expect(vitePlugin.defaultConfig).toBeDefined()
281
- })
282
-
283
- it('should setup successfully', async () => {
284
- await vitePlugin.setup!(context)
285
- expect(mockLogger.info).toHaveBeenCalledWith(
286
- expect.stringContaining('Setting up Vite integration')
287
- )
288
- })
289
-
290
- it('should handle server start', async () => {
291
- // Setup first to initialize vite config
292
- await vitePlugin.setup!(context)
293
- await vitePlugin.onServerStart!(context)
294
- expect(mockLogger.info).toHaveBeenCalledWith(
295
- expect.stringContaining('Vite integration active')
296
- )
297
- })
298
- })
299
-
300
- describe('Static Plugin', () => {
301
- it('should have correct metadata', () => {
302
- expect(staticPlugin.name).toBe('static')
303
- expect(staticPlugin.priority).toBe('low')
304
- expect(staticPlugin.category).toBe('core')
305
- expect(staticPlugin.configSchema).toBeDefined()
306
- expect(staticPlugin.defaultConfig).toBeDefined()
307
- })
308
-
309
- it('should setup successfully', async () => {
310
- await staticPlugin.setup!(context)
311
- expect(mockApp.get).toHaveBeenCalledWith('/*', expect.any(Function))
312
- expect(mockLogger.info).toHaveBeenCalledWith(
313
- 'Enhanced static files plugin activated',
314
- expect.any(Object)
315
- )
316
- })
317
-
318
- it('should handle server start', async () => {
319
- await staticPlugin.onServerStart!(context)
320
- expect(mockLogger.info).toHaveBeenCalledWith(
321
- expect.stringContaining('Static files plugin ready'),
322
- expect.any(Object)
323
- )
324
- })
325
- })
326
-
327
- describe('Plugin Utilities', () => {
328
- it('should get default plugins for development', () => {
329
- const plugins = getDefaultPlugins('development')
330
- expect(plugins).toHaveLength(5)
331
- expect(plugins).toContain(loggerPlugin)
332
- expect(plugins).toContain(staticPlugin)
333
- expect(plugins).toContain(vitePlugin)
334
- expect(plugins).toContain(swaggerPlugin)
335
- expect(plugins).toContain(monitoringPlugin)
336
- })
337
-
338
- it('should get default plugins for production', () => {
339
- const plugins = getDefaultPlugins('production')
340
- expect(plugins).toHaveLength(3)
341
- expect(plugins).toContain(loggerPlugin)
342
- expect(plugins).toContain(staticPlugin)
343
- expect(plugins).toContain(monitoringPlugin)
344
- })
345
-
346
- it('should get default plugins for test', () => {
347
- const plugins = getDefaultPlugins('test')
348
- expect(plugins).toHaveLength(1)
349
- expect(plugins).toContain(loggerPlugin)
350
- })
351
-
352
- it('should get plugin by name', () => {
353
- expect(getBuiltInPlugin('logger')).toBe(loggerPlugin)
354
- expect(getBuiltInPlugin('swagger')).toBe(swaggerPlugin)
355
- expect(getBuiltInPlugin('monitoring')).toBe(monitoringPlugin)
356
- expect(getBuiltInPlugin('nonexistent')).toBeUndefined()
357
- })
358
-
359
- it('should check if plugin is built-in', () => {
360
- expect(isBuiltInPlugin('logger')).toBe(true)
361
- expect(isBuiltInPlugin('swagger')).toBe(true)
362
- expect(isBuiltInPlugin('monitoring')).toBe(true)
363
- expect(isBuiltInPlugin('custom-plugin')).toBe(false)
364
- })
365
- })
366
- })