launchbase 1.0.7 ā 1.0.9
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/bin/launchbase.js +31 -13
- package/package.json +1 -1
package/bin/launchbase.js
CHANGED
|
@@ -7,7 +7,7 @@ const crypto = require('crypto');
|
|
|
7
7
|
const fs = require('fs-extra');
|
|
8
8
|
const { execSync, spawn } = require('child_process');
|
|
9
9
|
|
|
10
|
-
const VERSION = '1.0.
|
|
10
|
+
const VERSION = '1.0.9';
|
|
11
11
|
const program = new Command();
|
|
12
12
|
|
|
13
13
|
function findAvailablePort(startPort = 5432, maxAttempts = 100) {
|
|
@@ -472,11 +472,17 @@ program
|
|
|
472
472
|
console.log('š¦ Installing dependencies...\n');
|
|
473
473
|
runCommand('npm install', { cwd: targetDir });
|
|
474
474
|
|
|
475
|
+
// Install frontend dependencies if template was requested
|
|
475
476
|
if (options.template) {
|
|
476
477
|
const frontendPath = path.join(targetDir, 'frontend');
|
|
478
|
+
console.log(` Checking frontend path: ${frontendPath}`);
|
|
479
|
+
console.log(` Frontend exists: ${await fs.pathExists(frontendPath)}`);
|
|
480
|
+
|
|
477
481
|
if (await fs.pathExists(frontendPath)) {
|
|
478
482
|
console.log('\nš¦ Installing frontend dependencies...\n');
|
|
479
483
|
runCommand('npm install', { cwd: frontendPath });
|
|
484
|
+
} else {
|
|
485
|
+
console.log(' ā ļø Frontend folder not found. Template may not have been copied.\n');
|
|
480
486
|
}
|
|
481
487
|
}
|
|
482
488
|
|
|
@@ -490,9 +496,18 @@ program
|
|
|
490
496
|
// Wait a moment for DB to be fully ready
|
|
491
497
|
await new Promise(r => setTimeout(r, 2000));
|
|
492
498
|
|
|
493
|
-
// Run migrations
|
|
494
|
-
console.log('š
|
|
495
|
-
|
|
499
|
+
// Run migrations - use reset for fresh projects to avoid drift
|
|
500
|
+
console.log('š Setting up database schema...\n');
|
|
501
|
+
try {
|
|
502
|
+
// Try reset first (for fresh DB or when there's drift)
|
|
503
|
+
execSync('npx prisma migrate reset --force', {
|
|
504
|
+
cwd: targetDir,
|
|
505
|
+
stdio: 'inherit'
|
|
506
|
+
});
|
|
507
|
+
} catch {
|
|
508
|
+
// If reset fails, try regular migrate
|
|
509
|
+
runCommand('npx prisma migrate dev --name init', { cwd: targetDir });
|
|
510
|
+
}
|
|
496
511
|
dbReady = true;
|
|
497
512
|
}
|
|
498
513
|
}
|
|
@@ -523,18 +538,20 @@ program
|
|
|
523
538
|
env: { ...process.env, PORT: apiPort.toString() }
|
|
524
539
|
});
|
|
525
540
|
|
|
526
|
-
// Start frontend
|
|
541
|
+
// Start frontend if included
|
|
542
|
+
let frontend = null;
|
|
527
543
|
if (options.template) {
|
|
528
544
|
const frontendPath = path.join(targetDir, 'frontend');
|
|
529
545
|
if (await fs.pathExists(frontendPath)) {
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
546
|
+
console.log('šØ Starting frontend development server...\n');
|
|
547
|
+
frontend = spawn('npm', ['run', 'dev'], {
|
|
548
|
+
cwd: frontendPath,
|
|
549
|
+
stdio: 'inherit',
|
|
550
|
+
shell: true,
|
|
551
|
+
env: { ...process.env, VITE_API_URL: `http://localhost:${apiPort}`, PORT: frontendPort.toString() }
|
|
552
|
+
});
|
|
553
|
+
} else {
|
|
554
|
+
console.log('ā ļø Frontend folder not found at ' + frontendPath + '\n');
|
|
538
555
|
}
|
|
539
556
|
}
|
|
540
557
|
|
|
@@ -542,6 +559,7 @@ program
|
|
|
542
559
|
process.on('SIGINT', () => {
|
|
543
560
|
console.log('\n\nš Shutting down...');
|
|
544
561
|
backend.kill();
|
|
562
|
+
if (frontend) frontend.kill();
|
|
545
563
|
process.exit(0);
|
|
546
564
|
});
|
|
547
565
|
});
|
package/package.json
CHANGED