Fixing calander
This commit is contained in:
+33
-3
@@ -1,12 +1,42 @@
|
||||
// ── Dependency Check ─────────────────────────────────────────────────
|
||||
// Verifies all packages listed in package.json are installed.
|
||||
// Auto-runs npm install if any are missing — zero manual setup steps.
|
||||
|
||||
import { readFileSync } from "node:fs"
|
||||
import { resolve, dirname } from "node:path"
|
||||
import { fileURLToPath } from "node:url"
|
||||
import { createRequire } from "node:module"
|
||||
import { execSync } from "node:child_process"
|
||||
import { platform } from "node:os"
|
||||
|
||||
const __dirname = dirname(fileURLToPath(import.meta.url))
|
||||
const root = resolve(__dirname, "..")
|
||||
|
||||
try {
|
||||
const pkg = JSON.parse(readFileSync(resolve(root, "package.json"), "utf8"))
|
||||
const allDeps = { ...pkg.dependencies, ...pkg.devDependencies }
|
||||
const require = createRequire(import.meta.url)
|
||||
|
||||
const missing = Object.keys(allDeps).filter(name => {
|
||||
try { require.resolve(name, { paths: [root] }); return false } catch { return true }
|
||||
})
|
||||
|
||||
if (missing.length > 0) {
|
||||
console.log(`\n${missing.length} package(s) missing: ${missing.join(", ")}`)
|
||||
console.log("Installing...\n")
|
||||
execSync("npm install --no-audit --no-fund", { cwd: root, stdio: "inherit", timeout: 120000 })
|
||||
console.log("Dependencies installed\n")
|
||||
}
|
||||
} catch {
|
||||
// If package.json read or resolution fails, skip silently
|
||||
}
|
||||
|
||||
// ── Port Precheck ──────────────────────────────────────────────────
|
||||
// Kills any existing processes on ports 3001, 3006, 3007, 3008.
|
||||
// These are the AI server, Next.js frontend, Signaling server, and
|
||||
// Python scraper respectively.
|
||||
// Runs before anything else starts to avoid EADDRINUSE errors.
|
||||
|
||||
import { execSync } from "node:child_process"
|
||||
import { platform } from "node:os"
|
||||
|
||||
const PORTS = [3001, 3006, 3007, 3008]
|
||||
|
||||
if (platform() === "win32") {
|
||||
|
||||
Reference in New Issue
Block a user