build: package standalone self hosted runtime

This commit is contained in:
poyrazavsever
2026-07-18 20:18:23 +03:00
parent 090d10ae31
commit 100b624061
10 changed files with 48 additions and 12223 deletions
+29
View File
@@ -0,0 +1,29 @@
import { cp, mkdir, stat } from "node:fs/promises";
import path from "node:path";
const rootDir = process.cwd();
const standaloneDir = path.join(rootDir, ".next", "standalone");
async function requireDirectory(directory, label) {
const info = await stat(directory).catch(() => null);
if (!info?.isDirectory()) {
throw new Error(`${label} bulunamadı: ${directory}`);
}
}
await requireDirectory(standaloneDir, "Next.js standalone çıktısı");
await requireDirectory(path.join(rootDir, ".next", "static"), "Next.js static çıktısı");
await requireDirectory(path.join(rootDir, "public"), "Public dizini");
await mkdir(path.join(standaloneDir, ".next"), { recursive: true });
await cp(path.join(rootDir, ".next", "static"), path.join(standaloneDir, ".next", "static"), {
recursive: true,
force: true,
});
await cp(path.join(rootDir, "public"), path.join(standaloneDir, "public"), {
recursive: true,
force: true,
});
console.log("Standalone runtime assets prepared.");