create-fluxstack 1.0.12 → 1.0.13

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.
@@ -36,7 +36,9 @@ describe('Configuration Loader', () => {
36
36
  // Clear relevant environment variables
37
37
  for (const key in process.env) {
38
38
  if (key.startsWith('FLUXSTACK_') || key.startsWith('PORT') || key.startsWith('HOST') ||
39
- key.startsWith('NODE_ENV')) {
39
+ key.startsWith('NODE_ENV') || key.startsWith('CORS_') || key.startsWith('LOG_') ||
40
+ key.startsWith('MONITORING_') || key.startsWith('METRICS_') || key.startsWith('PROFILING_') ||
41
+ key.startsWith('BUILD_')) {
40
42
  delete process.env[key]
41
43
  }
42
44
  }
@@ -109,45 +111,6 @@ describe('Configuration Loader', () => {
109
111
  expect(config.server?.cors?.credentials).toBe(true)
110
112
  })
111
113
 
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
114
 
152
115
  test('handles monitoring configuration', () => {
153
116
  process.env.MONITORING_ENABLED = 'true'
@@ -164,10 +127,10 @@ describe('Configuration Loader', () => {
164
127
  })
165
128
 
166
129
  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'
130
+ process.env.FLUXSTACK_BUILD_TARGET = 'docker'
131
+ process.env.FLUXSTACK_BUILD_OUTDIR = 'build'
132
+ process.env.FLUXSTACK_BUILD_MINIFY = 'true'
133
+ process.env.FLUXSTACK_BUILD_SOURCEMAPS = 'false'
171
134
 
172
135
  reloadConfig()
173
136
  const config = getConfigSync()
@@ -565,12 +528,12 @@ describe('Configuration Loader', () => {
565
528
  test('handles configuration with warnings gracefully', () => {
566
529
  // Test with invalid environment variables that should generate warnings
567
530
  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
531
+ process.env.LOG_LEVEL = 'debug' // Valid value
532
+ process.env.FLUXSTACK_BUILD_TARGET = 'bun' // Valid value
570
533
 
571
534
  expect(() => {
572
535
  const config = getConfigSync()
573
- // Should not throw, but use defaults
536
+ // Should not throw, but use defaults for invalid values
574
537
  expect(typeof config.server?.port).toBe('number')
575
538
  expect(['debug', 'info', 'warn', 'error']).toContain(config.logging?.level)
576
539
  expect(['bun', 'node', 'docker']).toContain(config.build?.target)
@@ -56,6 +56,7 @@ const ENV_MAPPINGS = {
56
56
 
57
57
  // Server configuration
58
58
  'PORT': 'server.port',
59
+ 'FLUXSTACK_PORT': 'server.port',
59
60
  'HOST': 'server.host',
60
61
  'FLUXSTACK_API_PREFIX': 'server.apiPrefix',
61
62
  'CORS_ORIGINS': 'server.cors.origins',
@@ -107,34 +108,9 @@ const ENV_MAPPINGS = {
107
108
  'PROFILING_SAMPLE_RATE': 'monitoring.profiling.sampleRate',
108
109
  'FLUXSTACK_PROFILING_SAMPLE_RATE': 'monitoring.profiling.sampleRate',
109
110
 
110
- // Database configuration
111
- 'DATABASE_URL': 'database.url',
112
- 'DATABASE_HOST': 'database.host',
113
- 'DATABASE_PORT': 'database.port',
114
- 'DATABASE_NAME': 'database.database',
115
- 'DATABASE_USER': 'database.user',
116
- 'DATABASE_PASSWORD': 'database.password',
117
- 'DATABASE_SSL': 'database.ssl',
118
- 'DATABASE_POOL_SIZE': 'database.poolSize',
119
-
120
- // Auth configuration
121
- 'JWT_SECRET': 'auth.secret',
122
- 'JWT_EXPIRES_IN': 'auth.expiresIn',
123
- 'JWT_ALGORITHM': 'auth.algorithm',
124
- 'JWT_ISSUER': 'auth.issuer',
125
-
126
- // Email configuration
127
- 'SMTP_HOST': 'email.host',
128
- 'SMTP_PORT': 'email.port',
129
- 'SMTP_USER': 'email.user',
130
- 'SMTP_PASSWORD': 'email.password',
131
- 'SMTP_SECURE': 'email.secure',
132
- 'SMTP_FROM': 'email.from',
133
-
134
- // Storage configuration
135
- 'UPLOAD_PATH': 'storage.uploadPath',
136
- 'MAX_FILE_SIZE': 'storage.maxFileSize',
137
- 'STORAGE_PROVIDER': 'storage.provider'
111
+ // Plugin configuration
112
+ 'FLUXSTACK_PLUGINS_ENABLED': 'plugins.enabled',
113
+ 'FLUXSTACK_PLUGINS_DISABLED': 'plugins.disabled'
138
114
  } as const
139
115
 
140
116
  /**
@@ -231,12 +207,12 @@ function loadFromEnvironment(prefix = 'FLUXSTACK_'): Partial<FluxStackConfig> {
231
207
  try {
232
208
  // Determine target type from config path
233
209
  let targetType = 'string'
234
- if (configPath.includes('port') || configPath.includes('maxAge') || configPath.includes('collectInterval') || configPath.includes('sampleRate') || configPath.includes('poolSize')) {
210
+ if (configPath.includes('port') || configPath.includes('maxAge') || configPath.includes('collectInterval') || configPath.includes('sampleRate')) {
235
211
  targetType = 'number'
236
- } else if (configPath.includes('enabled') || configPath.includes('credentials') || configPath.includes('ssl') || configPath.includes('secure') || configPath.includes('minify') || configPath.includes('treeshake') || configPath.includes('compress') || configPath.includes('splitChunks') || configPath.includes('bundleAnalyzer') || configPath.includes('sourceMaps') || configPath.includes('clean')) {
237
- targetType = 'boolean'
238
- } else if (configPath.includes('origins') || configPath.includes('methods') || configPath.includes('headers') || configPath.includes('exporters')) {
212
+ } else if (configPath.includes('origins') || configPath.includes('methods') || configPath.includes('headers') || configPath.includes('exporters') || configPath.includes('plugins.enabled') || configPath.includes('plugins.disabled')) {
239
213
  targetType = 'array'
214
+ } else if (configPath.includes('enabled') || configPath.includes('credentials') || configPath.includes('minify') || configPath.includes('treeshake') || configPath.includes('compress') || configPath.includes('splitChunks') || configPath.includes('bundleAnalyzer') || configPath.includes('sourceMaps') || configPath.includes('clean')) {
215
+ targetType = 'boolean'
240
216
  }
241
217
 
242
218
  const parsedValue = parseEnvValue(envValue, targetType)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-fluxstack",
3
- "version": "1.0.12",
3
+ "version": "1.0.13",
4
4
  "description": "⚡ Modern full-stack TypeScript framework with Elysia + React + Bun",
5
5
  "keywords": ["framework", "full-stack", "typescript", "elysia", "react", "bun", "vite"],
6
6
  "author": "FluxStack Team",