create-skateboard-app 1.0.4 → 1.0.6
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/CHANGELOG.md +13 -0
- package/README.md +0 -2
- package/bin/cli.js +35 -24
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,4 +1,17 @@
|
|
|
1
1
|
|
|
2
|
+
1.0.6
|
|
3
|
+
|
|
4
|
+
Update config format
|
|
5
|
+
Support databases array
|
|
6
|
+
Add backward compatibility
|
|
7
|
+
|
|
8
|
+
1.0.5
|
|
9
|
+
|
|
10
|
+
Remove env setup references
|
|
11
|
+
Auto initialize git
|
|
12
|
+
Remove configuration summary
|
|
13
|
+
Update messaging
|
|
14
|
+
|
|
2
15
|
1.0.4
|
|
3
16
|
|
|
4
17
|
Update README documentation
|
package/README.md
CHANGED
package/bin/cli.js
CHANGED
|
@@ -250,7 +250,7 @@ async function collectProjectConfig(projectName) {
|
|
|
250
250
|
|
|
251
251
|
// Installation preferences
|
|
252
252
|
const installDeps = true; // Always install dependencies
|
|
253
|
-
const initGit =
|
|
253
|
+
const initGit = true; // Always initialize git repository
|
|
254
254
|
|
|
255
255
|
return {
|
|
256
256
|
companyName,
|
|
@@ -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
|
-
|
|
375
|
-
|
|
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
|
-
|
|
382
|
+
dbConfig.connectionString = config.database.connectionString;
|
|
378
383
|
} else if (config.database.value === 'postgresql') {
|
|
379
|
-
|
|
380
|
-
configObj.connectionString = '${POSTGRES_URL}';
|
|
384
|
+
dbConfig.connectionString = '${POSTGRES_URL}';
|
|
381
385
|
} else if (config.database.value === 'mongodb') {
|
|
382
|
-
|
|
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
|
-
|
|
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
|
|
|
@@ -436,13 +456,6 @@ async function main() {
|
|
|
436
456
|
// Success message
|
|
437
457
|
log(`\n${colors.bold}${colors.green}🎉 Success! Created ${config.appName}${colors.reset}\n`);
|
|
438
458
|
|
|
439
|
-
log(`\n${colors.cyan}Your app is configured with:${colors.reset}`);
|
|
440
|
-
log(` 📱 App: ${config.appName}`);
|
|
441
|
-
log(` 💬 Tagline: ${config.tagline}`);
|
|
442
|
-
log(` 🎨 Color: ${config.appColor}`);
|
|
443
|
-
log(` 🎯 Icon: ${config.appIcon}`);
|
|
444
|
-
log(` 🗃️ Database: ${config.database.value}`);
|
|
445
|
-
|
|
446
459
|
// Database-specific instructions (only if connection string not provided)
|
|
447
460
|
if (config.database.value === 'postgresql' && !config.connectionString) {
|
|
448
461
|
log(`\n${colors.yellow}📝 PostgreSQL Setup:${colors.reset}`);
|
|
@@ -463,10 +476,8 @@ async function main() {
|
|
|
463
476
|
|
|
464
477
|
log(`\n${colors.bold}Get started with:${colors.reset}`, 'yellow');
|
|
465
478
|
log(`\n ${colors.cyan}cd ${projectName}${colors.reset}`);
|
|
466
|
-
log(` ${colors.cyan}cp backend/.env.example backend/.env${colors.reset}`);
|
|
467
|
-
log(` ${colors.cyan}# Edit backend/.env with your credentials${colors.reset}`);
|
|
468
479
|
log(` ${colors.cyan}npm run start${colors.reset}`);
|
|
469
|
-
log(`\n${colors.yellow}Happy
|
|
480
|
+
log(`\n${colors.yellow}Happy skating! 🛹${colors.reset}\n`);
|
|
470
481
|
|
|
471
482
|
} catch (err) {
|
|
472
483
|
error(`Failed to create project: ${err.message}`);
|