From 0b9a112c5bdd8015afa57037e92a08aeb8dc0c98 Mon Sep 17 00:00:00 2001 From: Liam Date: Sun, 21 Apr 2024 20:18:01 +0100 Subject: [PATCH] maybe fix? --- next.config.mjs | 17 ++++++++++++++++- package.json | 1 + pnpm-lock.yaml | 8 ++++++++ 3 files changed, 25 insertions(+), 1 deletion(-) diff --git a/next.config.mjs b/next.config.mjs index ef24b00..e536b45 100644 --- a/next.config.mjs +++ b/next.config.mjs @@ -1,4 +1,16 @@ import { withSentryConfig } from "@sentry/nextjs"; +import nextBuildId from "next-build-id"; +import { fileURLToPath } from "url"; +import path from "path"; + +/** + * The current git commit hash. + * + * @type {string|string} The current git commit hash. + */ +const buildId = ( + process.env.GIT_REV || nextBuildId.sync({ dir: path.dirname(fileURLToPath(import.meta.url)) }) +).substring(0, 7); /** @type {import('next').NextConfig} */ const nextConfig = { @@ -17,6 +29,9 @@ const nextConfig = { }, ], }, + env: { + NEXT_PUBLIC_BUILD_ID: buildId, + }, experimental: { mdxRs: true, }, @@ -32,7 +47,7 @@ export default withSentryConfig( project: "frontend", url: "https://glitchtip.fascinated.cc/", authToken: process.env.SENTRY_AUTH_TOKEN || "", - release: `frontend@${process.env.GIT_REV || "dev"}`, + release: `frontend@${buildId}`, }, { // For all available options, see: diff --git a/package.json b/package.json index d8cc48c..e353843 100644 --- a/package.json +++ b/package.json @@ -34,6 +34,7 @@ "mcutils-library": "^1.2.6", "moment": "^2.30.1", "next": "14.2.2", + "next-build-id": "^3.0.0", "next-themes": "^0.3.0", "react": "^18", "react-countup": "^6.5.3", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index e7af913..2c99f73 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -86,6 +86,9 @@ dependencies: next: specifier: 14.2.2 version: 14.2.2(@babel/core@7.24.4)(react-dom@18.2.0)(react@18.2.0) + next-build-id: + specifier: ^3.0.0 + version: 3.0.0 next-themes: specifier: ^0.3.0 version: 0.3.0(react-dom@18.2.0)(react@18.2.0) @@ -6279,6 +6282,11 @@ packages: resolution: {integrity: sha512-Yd3UES5mWCSqR+qNT93S3UoYUkqAZ9lLg8a7g9rimsWmYGK8cVToA4/sF3RrshdyV3sAGMXVUmpMYOw+dLpOuw==} dev: false + /next-build-id@3.0.0: + resolution: {integrity: sha512-B3JCsL/9Z/wkmo3EySukQHCgx89Aw0i4LPi2MEhCboQBJ6wpkYTIu1z6hOYKuw/S1Wy8ZRqCEq0dVY/ST6jGqg==} + engines: {node: '>=8'} + dev: false + /next-themes@0.3.0(react-dom@18.2.0)(react@18.2.0): resolution: {integrity: sha512-/QHIrsYpd6Kfk7xakK4svpDI5mmXP0gfvCoJdGpZQ2TOrQZmsW0QxjaiLn8wbIKjtm4BTSqLoix4lxYYOnLJ/w==} peerDependencies: