@reliverse/rse
Version:
@reliverse/rse is your all-in-one companion for bootstrapping and improving any kind of projects (especially web apps built with frameworks like Next.js) — whether you're kicking off something new or upgrading an existing app. It is also a little AI-power
36 lines (35 loc) • 1.02 kB
JavaScript
import { relinka } from "@reliverse/relinka";
import { defineArgs, defineCommand } from "@reliverse/rempts";
import { $ } from "bun";
import { dirname, join } from "path";
import { fileURLToPath } from "url";
export default defineCommand({
meta: {
name: "web",
description: "Start the rse web ui"
},
args: defineArgs({
dev: {
type: "boolean",
description: "Run in development mode"
}
}),
async run({ args }) {
if (!process.versions.bun) {
throw new Error(
"This command requires Bun runtime. Please install Bun first: https://bun.sh/get"
);
}
const __dirname = dirname(fileURLToPath(import.meta.url));
const webServerPath = join(__dirname, "index.tsx");
if (args.dev) {
relinka(
"warn",
"[isDev=true] It's recommended to use `bun dev:web` instead to get fully correct hot reloading."
);
await $`bun --watch ${webServerPath}`;
} else {
await $`NODE_ENV=production bun ${webServerPath}`;
}
}
});