mirror of
https://github.com/LukeHagar/better-auth.git
synced 2025-12-07 12:27:44 +00:00
24 lines
576 B
TypeScript
24 lines
576 B
TypeScript
import { getPackageVersion } from "../utils/package-json";
|
|
|
|
const FRAMEWORKS: Record<string, string> = {
|
|
next: "next",
|
|
nuxt: "nuxt",
|
|
"@remix-run/server-runtime": "remix",
|
|
astro: "astro",
|
|
"@sveltejs/kit": "sveltekit",
|
|
"solid-start": "solid-start",
|
|
"tanstack-start": "tanstack-start",
|
|
hono: "hono",
|
|
express: "express",
|
|
elysia: "elysia",
|
|
expo: "expo",
|
|
};
|
|
|
|
export async function detectFramework() {
|
|
for (const [pkg, name] of Object.entries(FRAMEWORKS)) {
|
|
const version = await getPackageVersion(pkg);
|
|
if (version) return { name, version };
|
|
}
|
|
return undefined;
|
|
}
|