perf(build): make standalone image deterministic

This commit is contained in:
2026-08-09 21:34:00 +07:00 Unverified
parent c06b2ef88f
commit 1dc44e0215
10 changed files with 65 additions and 32 deletions
+3 -3
View File
@@ -42,10 +42,10 @@ export async function POST(request: Request) {
const stagingDirectory = `${VIDEO_DIR}/staging/${discordId}`;
filePath = `${stagingDirectory}/${stagedVideoId}-${safeFileName(originalFilename)}`;
await mkdir(stagingDirectory, { recursive: true });
await mkdir(/* turbopackIgnore: true */ stagingDirectory, { recursive: true });
await pipeline(
Readable.fromWeb(request.body as never),
createWriteStream(filePath, { flags: "wx" }),
createWriteStream(/* turbopackIgnore: true */ filePath, { flags: "wx" }),
);
return NextResponse.json({
@@ -55,7 +55,7 @@ export async function POST(request: Request) {
size: contentLength,
});
} catch (error) {
if (filePath) await unlink(filePath).catch(() => undefined);
if (filePath) await unlink(/* turbopackIgnore: true */ filePath).catch(() => undefined);
const message = error instanceof Error ? error.message : "Upload failed.";
const status =
message === "Unauthorized" || message === "Not authenticated" ? 401 : 400;
+36
View File
@@ -3,6 +3,42 @@
@import "tw-animate-css";
@import "shadcn/tailwind.css";
@font-face {
font-family: "Inter";
font-style: normal;
font-weight: 100 900;
font-display: swap;
src: url("/fonts/inter-latin.woff2") format("woff2");
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6,
U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122,
U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
font-family: "Anuphan";
font-style: normal;
font-weight: 100 700;
font-display: swap;
src: url("/fonts/anuphan-thai.woff2") format("woff2");
unicode-range: U+02D7, U+0303, U+0331, U+0E01-0E5B, U+200C-200D, U+25CC;
}
@font-face {
font-family: "Anuphan";
font-style: normal;
font-weight: 100 700;
font-display: swap;
src: url("/fonts/anuphan-latin.woff2") format("woff2");
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6,
U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122,
U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
:root {
--font-inter: "Inter", Arial, sans-serif;
--font-anuphan: "Anuphan", Tahoma, sans-serif;
}
@custom-variant dark (&:is(.dark *));
@theme inline {
+1 -14
View File
@@ -1,21 +1,8 @@
import type { Metadata } from "next";
import { Inter, Anuphan } from "next/font/google";
import "./globals.css";
import { cn } from "@/lib/utils";
import { config } from "@/lib/config";
const inter = Inter({
variable: "--font-inter",
subsets: ["latin"],
display: "swap",
});
const anuphan = Anuphan({
variable: "--font-anuphan",
subsets: ["latin", "thai"],
display: "swap",
});
const siteUrl = config.site.url;
export const metadata: Metadata = {
@@ -81,7 +68,7 @@ export default function RootLayout({
return (
<html
lang="th"
className={cn("h-full", "antialiased", inter.variable, anuphan.variable, "font-sans")}
className={cn("h-full", "antialiased", "font-sans")}
suppressHydrationWarning
>
<body className="font-sans" suppressHydrationWarning>