create-skateboard-app 1.1.2 → 1.1.3
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 +3 -0
- package/bin/cli.js +24 -13
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
package/bin/cli.js
CHANGED
|
@@ -402,21 +402,32 @@ async function main() {
|
|
|
402
402
|
success(`Database configured: ${config.database.value}`);
|
|
403
403
|
}
|
|
404
404
|
|
|
405
|
-
// Create .env file
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
405
|
+
// Create .env file from .env.example
|
|
406
|
+
info('Creating .env file...');
|
|
407
|
+
const backendDir = join(projectName, 'backend');
|
|
408
|
+
const envExamplePath = join(backendDir, '.env.example');
|
|
409
|
+
const envPath = join(backendDir, '.env');
|
|
410
|
+
|
|
411
|
+
if (existsSync(envExamplePath)) {
|
|
412
|
+
let envContent = readFileSync(envExamplePath, 'utf8');
|
|
413
|
+
|
|
414
|
+
// Uncomment the relevant database line
|
|
415
|
+
if (config.database.value === 'mongodb') {
|
|
416
|
+
if (config.connectionString) {
|
|
417
|
+
envContent = envContent.replace(/# MONGODB_URL=.*/, `MONGODB_URL=${config.connectionString}`);
|
|
418
|
+
} else {
|
|
419
|
+
envContent = envContent.replace(/# MONGODB_URL=/, 'MONGODB_URL=');
|
|
420
|
+
}
|
|
421
|
+
} else if (config.database.value === 'postgresql') {
|
|
422
|
+
if (config.connectionString) {
|
|
423
|
+
envContent = envContent.replace(/# POSTGRES_URL=.*/, `POSTGRES_URL=${config.connectionString}`);
|
|
424
|
+
} else {
|
|
425
|
+
envContent = envContent.replace(/# POSTGRES_URL=/, 'POSTGRES_URL=');
|
|
426
|
+
}
|
|
414
427
|
}
|
|
415
|
-
|
|
416
|
-
const envVar = config.database.value === 'postgresql' ? 'POSTGRES_URL' : 'MONGODB_URL';
|
|
417
|
-
const envContent = `${envVar}=${config.connectionString}\n`;
|
|
428
|
+
|
|
418
429
|
writeFileSync(envPath, envContent);
|
|
419
|
-
success('.env file created
|
|
430
|
+
success('.env file created');
|
|
420
431
|
}
|
|
421
432
|
|
|
422
433
|
// Step 6: Update app color in styles.css
|
package/package.json
CHANGED