first commit
This commit is contained in:
commit
af43d08e90
41 changed files with 5197 additions and 0 deletions
48
scripts/dev.js
Normal file
48
scripts/dev.js
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
#!/usr/bin/env bun
|
||||
|
||||
import { $ } from "bun";
|
||||
import { spawn } from "child_process";
|
||||
import path from "path";
|
||||
|
||||
console.log("🚀 Запуск серверов avtourist086...\n");
|
||||
|
||||
// Запуск PocketBase
|
||||
const backend = spawn("pocketbase.exe", ["serve"], {
|
||||
cwd: path.join(process.cwd(), "backend"),
|
||||
stdio: "inherit",
|
||||
shell: true,
|
||||
});
|
||||
|
||||
// Запуск Astro
|
||||
const frontend = spawn("bun", ["dev"], {
|
||||
cwd: "frontend",
|
||||
stdio: "inherit",
|
||||
shell: true,
|
||||
});
|
||||
|
||||
// Обработка завершения
|
||||
const cleanup = () => {
|
||||
console.log("\n🛑 Остановка серверов...");
|
||||
backend.kill();
|
||||
frontend.kill();
|
||||
process.exit(0);
|
||||
};
|
||||
|
||||
process.on("SIGINT", cleanup);
|
||||
process.on("SIGTERM", cleanup);
|
||||
|
||||
// Ожидание завершения процессов
|
||||
backend.on("exit", (code) => {
|
||||
console.log(`Backend остановлен с кодом ${code}`);
|
||||
cleanup();
|
||||
});
|
||||
|
||||
frontend.on("exit", (code) => {
|
||||
console.log(`Frontend остановлен с кодом ${code}`);
|
||||
cleanup();
|
||||
});
|
||||
|
||||
console.log("✅ Серверы запущены:\n");
|
||||
console.log(" Backend (PocketBase): http://localhost:8090");
|
||||
console.log(" Frontend (Astro): http://localhost:4321\n");
|
||||
console.log("Нажмите Ctrl+C для остановки\n");
|
||||
Loading…
Add table
Add a link
Reference in a new issue