Merge remote-tracking branch 'origin/master' into gitea/feature/end
Resolved conflicts taking origin/master (v0.5.55) as canonical, with local features re-applied: - runtime log level (LOG_LEVEL env + dashboard Settings → Logging, applied immediately and persisted across restarts) - free/noAuth provider enable/disable toggle via providerStrategies.enabled - parallel model testing (Test All Models / Test Selected Keys)
This commit is contained in:
44
scripts/copy-standalone-assets.mjs
Normal file
44
scripts/copy-standalone-assets.mjs
Normal file
@@ -0,0 +1,44 @@
|
||||
import { cpSync, existsSync } from "node:fs";
|
||||
import { fileURLToPath } from "node:url";
|
||||
import { dirname, resolve } from "node:path";
|
||||
|
||||
export function copyStandaloneAssets({ projectRoot = process.cwd(), distDir = process.env.NEXT_DIST_DIR || ".next" } = {}) {
|
||||
if (process.env.NEXT_TRACING_ROOT_MODE === "workspace") {
|
||||
console.log("[standalone-assets] Skipping workspace-traced CLI build; CLI packaging handles assets");
|
||||
return;
|
||||
}
|
||||
|
||||
const buildDir = resolve(projectRoot, distDir);
|
||||
const standaloneDir = resolve(buildDir, "standalone");
|
||||
|
||||
if (!existsSync(standaloneDir)) {
|
||||
console.log(`[standalone-assets] No standalone build found at ${standaloneDir}`);
|
||||
return;
|
||||
}
|
||||
|
||||
const staticSource = resolve(buildDir, "static");
|
||||
const staticDestination = resolve(standaloneDir, distDir, "static");
|
||||
if (existsSync(staticSource)) {
|
||||
cpSync(staticSource, staticDestination, { recursive: true, force: true });
|
||||
console.log(`[standalone-assets] Copied static assets to ${staticDestination}`);
|
||||
}
|
||||
|
||||
const publicSource = resolve(projectRoot, "public");
|
||||
const publicDestination = resolve(standaloneDir, "public");
|
||||
if (existsSync(publicSource)) {
|
||||
cpSync(publicSource, publicDestination, { recursive: true, force: true });
|
||||
console.log(`[standalone-assets] Copied public assets to ${publicDestination}`);
|
||||
}
|
||||
|
||||
// Without it beside server.js the standalone build serves requests unsanitized.
|
||||
const serverWrapperSource = resolve(projectRoot, "custom-server.js");
|
||||
const serverWrapperDestination = resolve(standaloneDir, "custom-server.js");
|
||||
if (existsSync(serverWrapperSource)) {
|
||||
cpSync(serverWrapperSource, serverWrapperDestination, { force: true });
|
||||
console.log(`[standalone-assets] Copied custom-server.js to ${serverWrapperDestination}`);
|
||||
}
|
||||
}
|
||||
|
||||
if (process.argv[1] && resolve(process.argv[1]) === resolve(dirname(fileURLToPath(import.meta.url)), "copy-standalone-assets.mjs")) {
|
||||
copyStandaloneAssets();
|
||||
}
|
||||
Reference in New Issue
Block a user