From 6ecf9fc7dc45f80be8f83c5e48ec183860bd01ad Mon Sep 17 00:00:00 2001 From: DIYgod Date: Sun, 9 Oct 2022 01:34:54 +0100 Subject: [PATCH] chore: use git commit hash as nextjs build id --- next.config.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/next.config.js b/next.config.js index 8d4b8c40..e1c91a5c 100644 --- a/next.config.js +++ b/next.config.js @@ -5,6 +5,9 @@ const { withIpfsGateway } = require("@crossbell/ipfs-gateway-next") const withBundleAnalyzer = require("@next/bundle-analyzer")({ enabled: process.env.ANALYZE === "true", }) +const execSync = require("child_process").execSync + +const lastCommitCommand = "git rev-parse HEAD" class UnoCSS { /** @@ -51,5 +54,9 @@ module.exports = withBundleAnalyzer( "default-src 'self'; script-src 'none'; sandbox; style-src 'unsafe-inline';", remotePatterns: [{ hostname: "**" }], }, + + async generateBuildId() { + return execSync(lastCommitCommand).toString().trim() + }, }), )