kofi-stack-template-generator 2.1.13 → 2.1.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/dist/index.js CHANGED
@@ -1462,6 +1462,42 @@ async function checkAndInstall() {
1462
1462
  }
1463
1463
  }
1464
1464
 
1465
+ function syncEnvToConvex(envVars) {
1466
+ // Sync required env vars to Convex cloud (only if not already synced)
1467
+ const requiredVars = ['BETTER_AUTH_SECRET', 'SITE_URL']
1468
+ let needsSync = false
1469
+
1470
+ // Check if env vars need syncing by trying to list them
1471
+ try {
1472
+ const result = execSync('npx convex env list', { cwd: backendDir, stdio: 'pipe' }).toString()
1473
+ for (const varName of requiredVars) {
1474
+ if (envVars[varName] && !result.includes(varName + '=')) {
1475
+ needsSync = true
1476
+ break
1477
+ }
1478
+ }
1479
+ } catch {
1480
+ needsSync = true
1481
+ }
1482
+
1483
+ if (needsSync) {
1484
+ console.log('\u{1F4E4} Syncing environment variables to Convex cloud...\\n')
1485
+ for (const varName of requiredVars) {
1486
+ if (envVars[varName]) {
1487
+ try {
1488
+ execSync(\`npx convex env set \${varName} "\${envVars[varName]}"\`, {
1489
+ cwd: backendDir,
1490
+ stdio: 'pipe'
1491
+ })
1492
+ console.log(\` \u2713 \${varName}\\n\`)
1493
+ } catch (error) {
1494
+ console.warn(\` \u26A0\uFE0F Could not set \${varName}\\n\`)
1495
+ }
1496
+ }
1497
+ }
1498
+ }
1499
+ }
1500
+
1465
1501
  function startDevServers() {
1466
1502
  ${isMonorepo ? "const backendEnv = syncEnvToWebApp()" : "const backendEnv = loadEnvFile(webAppDir)"}
1467
1503
 
@@ -1474,6 +1510,9 @@ function startDevServers() {
1474
1510
  return
1475
1511
  }
1476
1512
 
1513
+ // Sync env vars to Convex cloud if needed
1514
+ syncEnvToConvex(backendEnv)
1515
+
1477
1516
  console.log('\u{1F680} Starting development servers...\\n')
1478
1517
  spawn('pnpm', ['${isMonorepo ? "dev:all" : "dev:next"}'], {
1479
1518
  cwd: rootDir, stdio: 'inherit', shell: true
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kofi-stack-template-generator",
3
- "version": "2.1.13",
3
+ "version": "2.1.14",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
package/src/generator.ts CHANGED
@@ -282,6 +282,42 @@ async function checkAndInstall() {
282
282
  }
283
283
  }
284
284
 
285
+ function syncEnvToConvex(envVars) {
286
+ // Sync required env vars to Convex cloud (only if not already synced)
287
+ const requiredVars = ['BETTER_AUTH_SECRET', 'SITE_URL']
288
+ let needsSync = false
289
+
290
+ // Check if env vars need syncing by trying to list them
291
+ try {
292
+ const result = execSync('npx convex env list', { cwd: backendDir, stdio: 'pipe' }).toString()
293
+ for (const varName of requiredVars) {
294
+ if (envVars[varName] && !result.includes(varName + '=')) {
295
+ needsSync = true
296
+ break
297
+ }
298
+ }
299
+ } catch {
300
+ needsSync = true
301
+ }
302
+
303
+ if (needsSync) {
304
+ console.log('📤 Syncing environment variables to Convex cloud...\\n')
305
+ for (const varName of requiredVars) {
306
+ if (envVars[varName]) {
307
+ try {
308
+ execSync(\`npx convex env set \${varName} "\${envVars[varName]}"\`, {
309
+ cwd: backendDir,
310
+ stdio: 'pipe'
311
+ })
312
+ console.log(\` ✓ \${varName}\\n\`)
313
+ } catch (error) {
314
+ console.warn(\` ⚠️ Could not set \${varName}\\n\`)
315
+ }
316
+ }
317
+ }
318
+ }
319
+ }
320
+
285
321
  function startDevServers() {
286
322
  ${isMonorepo ? 'const backendEnv = syncEnvToWebApp()' : 'const backendEnv = loadEnvFile(webAppDir)'}
287
323
 
@@ -294,6 +330,9 @@ function startDevServers() {
294
330
  return
295
331
  }
296
332
 
333
+ // Sync env vars to Convex cloud if needed
334
+ syncEnvToConvex(backendEnv)
335
+
297
336
  console.log('🚀 Starting development servers...\\n')
298
337
  spawn('pnpm', ['${isMonorepo ? 'dev:all' : 'dev:next'}'], {
299
338
  cwd: rootDir, stdio: 'inherit', shell: true
@@ -1,6 +1,6 @@
1
1
  // Auto-generated file. Do not edit manually.
2
2
  // Run 'pnpm prebuild' to regenerate.
3
- // Generated: 2026-01-15T00:46:15.242Z
3
+ // Generated: 2026-01-15T01:53:42.963Z
4
4
  // Template count: 90
5
5
 
6
6
  export const EMBEDDED_TEMPLATES: Record<string, string> = {