refactor: remove custom build ID generation fallback and use timestamp-based ID
This commit is contained in:
parent
0ecd7ce30d
commit
6118ba505b
1 changed files with 1 additions and 12 deletions
|
|
@ -11,24 +11,13 @@ const withBundleAnalyzer = require("@next/bundle-analyzer")({
|
|||
enabled: process.env.ANALYZE === "true",
|
||||
});
|
||||
|
||||
function getBuildId(): string {
|
||||
try {
|
||||
const { execSync } = require("node:child_process");
|
||||
// Get short hash (8 characters) instead of full hash
|
||||
return execSync("git rev-parse --short=8 HEAD").toString().trim();
|
||||
} catch {
|
||||
// Fallback to timestamp-based ID
|
||||
return `${Date.now().toString(36)}`;
|
||||
}
|
||||
}
|
||||
|
||||
async function createNextConfig(): Promise<NextConfig> {
|
||||
const { createJiti } = await import("jiti");
|
||||
const jiti = createJiti(fileURLToPath(import.meta.url));
|
||||
|
||||
await jiti.import("./src/env.ts");
|
||||
|
||||
const buildId = getBuildId();
|
||||
const buildId = `${Date.now().toString(36)}`;
|
||||
const apiVersion = `v.${buildId}`;
|
||||
|
||||
return withBundleAnalyzer({
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue