create-skateboard-app 1.0.9 → 1.1.1

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 +5 -0
  2. package/bin/cli.js +10 -33
  3. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -1,3 +1,8 @@
1
+ 1.1.1
2
+ fixed database config
3
+
4
+ 1.1.0
5
+ changed constants to include /api route
1
6
 
2
7
  1.0.9
3
8
 
package/bin/cli.js CHANGED
@@ -241,8 +241,8 @@ async function collectProjectConfig(projectName) {
241
241
  }
242
242
 
243
243
  // Default values for removed questions
244
- const backendURL = 'https://api.example.com';
245
- const devBackendURL = 'http://localhost:8000';
244
+ const backendURL = '/api';
245
+ const devBackendURL = 'http://localhost:8000/api';
246
246
  const companyName = 'Your Company';
247
247
 
248
248
  // Read pages from the downloaded template's constants.json
@@ -384,40 +384,17 @@ async function main() {
384
384
  if (existsSync(backendConfigPath)) {
385
385
  const backendConfig = JSON.parse(readFileSync(backendConfigPath, 'utf8'));
386
386
 
387
- // Handle new format with databases array
388
- if (backendConfig.databases && Array.isArray(backendConfig.databases) && backendConfig.databases.length > 0) {
389
- const dbConfig = backendConfig.databases[0];
390
-
391
- // Set database configuration
392
- dbConfig.dbType = config.database.value;
393
- dbConfig.db = config.appName.replace(/\s+/g, '');
394
- dbConfig.origin = config.devBackendURL;
395
-
387
+ // Update the database configuration
388
+ if (backendConfig.database) {
389
+ backendConfig.database.dbType = config.database.value;
390
+ backendConfig.database.db = config.appName.replace(/\s+/g, '');
391
+
396
392
  if (config.database.value === 'sqlite') {
397
- dbConfig.connectionString = config.database.connectionString;
393
+ backendConfig.database.connectionString = config.database.connectionString;
398
394
  } else if (config.database.value === 'postgresql') {
399
- dbConfig.connectionString = '${POSTGRES_URL}';
395
+ backendConfig.database.connectionString = '${POSTGRES_URL}';
400
396
  } else if (config.database.value === 'mongodb') {
401
- dbConfig.connectionString = '${MONGODB_URL}';
402
- }
403
- } else {
404
- // Fallback for old format - handle both array and single object formats defensively
405
- const configArray = Array.isArray(backendConfig) ? backendConfig : [backendConfig];
406
-
407
- configArray.forEach(configObj => {
408
- configObj.dbType = config.database.value;
409
- if (config.database.value === 'sqlite') {
410
- configObj.connectionString = config.database.connectionString;
411
- } else if (config.database.value === 'postgresql') {
412
- configObj.connectionString = '${POSTGRES_URL}';
413
- } else if (config.database.value === 'mongodb') {
414
- configObj.connectionString = '${MONGODB_URL}';
415
- }
416
- });
417
-
418
- // Update backendConfig reference for old format
419
- if (!Array.isArray(backendConfig)) {
420
- Object.assign(backendConfig, configArray[0]);
397
+ backendConfig.database.connectionString = '${MONGODB_URL}';
421
398
  }
422
399
  }
423
400
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-skateboard-app",
3
- "version": "1.0.9",
3
+ "version": "1.1.1",
4
4
  "description": "Create a new Skateboard app with React, TailwindCSS, and more",
5
5
  "main": "index.js",
6
6
  "type": "module",