create-skateboard-app 1.0.5 → 1.0.7

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 (3) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/bin/cli.js +34 -14
  3. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -1,4 +1,14 @@
1
1
 
2
+ 1.0.7
3
+
4
+ Add Stripe guide
5
+
6
+ 1.0.6
7
+
8
+ Update config format
9
+ Support databases array
10
+ Add backward compatibility
11
+
2
12
  1.0.5
3
13
 
4
14
  Remove env setup references
package/bin/cli.js CHANGED
@@ -368,25 +368,45 @@ async function main() {
368
368
  const backendConfigPath = join(projectName, 'backend', 'config.json');
369
369
  if (existsSync(backendConfigPath)) {
370
370
  const backendConfig = JSON.parse(readFileSync(backendConfigPath, 'utf8'));
371
- // Handle both array and single object formats defensively
372
- const configArray = Array.isArray(backendConfig) ? backendConfig : [backendConfig];
373
371
 
374
- configArray.forEach(configObj => {
375
- configObj.dbType = config.database.value;
372
+ // Handle new format with databases array
373
+ if (backendConfig.databases && Array.isArray(backendConfig.databases) && backendConfig.databases.length > 0) {
374
+ const dbConfig = backendConfig.databases[0];
375
+
376
+ // Set database configuration
377
+ dbConfig.dbType = config.database.value;
378
+ dbConfig.db = config.appName.replace(/\s+/g, '');
379
+ dbConfig.origin = config.devBackendURL;
380
+
376
381
  if (config.database.value === 'sqlite') {
377
- configObj.connectionString = config.database.connectionString;
382
+ dbConfig.connectionString = config.database.connectionString;
378
383
  } else if (config.database.value === 'postgresql') {
379
- // Always use environment variable placeholder in config.json
380
- configObj.connectionString = '${POSTGRES_URL}';
384
+ dbConfig.connectionString = '${POSTGRES_URL}';
381
385
  } else if (config.database.value === 'mongodb') {
382
- // Always use environment variable placeholder in config.json
383
- configObj.connectionString = '${MONGODB_URL}';
386
+ dbConfig.connectionString = '${MONGODB_URL}';
384
387
  }
385
- });
388
+ } else {
389
+ // Fallback for old format - handle both array and single object formats defensively
390
+ const configArray = Array.isArray(backendConfig) ? backendConfig : [backendConfig];
391
+
392
+ configArray.forEach(configObj => {
393
+ configObj.dbType = config.database.value;
394
+ if (config.database.value === 'sqlite') {
395
+ configObj.connectionString = config.database.connectionString;
396
+ } else if (config.database.value === 'postgresql') {
397
+ configObj.connectionString = '${POSTGRES_URL}';
398
+ } else if (config.database.value === 'mongodb') {
399
+ configObj.connectionString = '${MONGODB_URL}';
400
+ }
401
+ });
402
+
403
+ // Update backendConfig reference for old format
404
+ if (!Array.isArray(backendConfig)) {
405
+ Object.assign(backendConfig, configArray[0]);
406
+ }
407
+ }
386
408
 
387
- // Write back the original format (array or single object)
388
- const finalConfig = Array.isArray(backendConfig) ? configArray : configArray[0];
389
- writeFileSync(backendConfigPath, JSON.stringify(finalConfig, null, 2));
409
+ writeFileSync(backendConfigPath, JSON.stringify(backendConfig, null, 2));
390
410
  success(`Database configured: ${config.database.value}`);
391
411
  }
392
412
 
@@ -452,7 +472,7 @@ async function main() {
452
472
  log(` Update the ${colors.cyan}backend/.env${colors.reset} file with:`);
453
473
  log(` ${colors.green}STRIPE_KEY=sk_test_your_stripe_secret_key_here${colors.reset}`);
454
474
  log(` ${colors.green}STRIPE_ENDPOINT_SECRET=whsec_your_webhook_endpoint_secret_here${colors.reset}`);
455
- log(` Get your keys from: ${colors.blue}https://dashboard.stripe.com/apikeys${colors.reset}`);
475
+ log(` Step by Step Guide: ${colors.blue}https://github.com/stevederico/skateboard#-stripe-setup${colors.reset}`);
456
476
 
457
477
  log(`\n${colors.bold}Get started with:${colors.reset}`, 'yellow');
458
478
  log(`\n ${colors.cyan}cd ${projectName}${colors.reset}`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-skateboard-app",
3
- "version": "1.0.5",
3
+ "version": "1.0.7",
4
4
  "description": "Create a new Skateboard app with React, TailwindCSS, and more",
5
5
  "main": "index.js",
6
6
  "type": "module",