nose-pluto/app/nose/bin/update.ts
2025-09-24 21:14:02 -07:00

17 lines
411 B
TypeScript

import { $ } from "bun"
export default async function () {
if (process.env.NODE_ENV !== "production") {
return { error: "Can only update in production." }
}
const { stdout } = await $`cd .. && git pull`.quiet()
const out = stdout.toString()
if (/up to date/.test(out)) {
return "Up to date."
} else {
setTimeout(() => process.exit(), 1000)
return "Restarting in 1 second..."
}
}