diff --git a/next.config.ts b/next.config.ts index 7c80856..0e7e874 100644 --- a/next.config.ts +++ b/next.config.ts @@ -1,15 +1,12 @@ import type { NextConfig } from "next"; -import build from "next/dist/build"; -import { describe } from "node:test"; -const nextBuildId = require('next-build-id'); - -const buildId = nextBuildId({ dir: __dirname, describe: true }) +import { version } from "./package.json"; const nextConfig: NextConfig = { output: "standalone", - generateBuildId: () => buildId, + generateBuildId: () => (process.env.GIT_COMMIT || null), env: { - BUILD_ID: buildId + BUILD_ID: process.env.GIT_COMMIT, + VERSION: version } }; diff --git a/package-lock.json b/package-lock.json index b869ace..d6d9b12 100644 --- a/package-lock.json +++ b/package-lock.json @@ -29,7 +29,6 @@ "dexie-react-hooks": "^1.1.7", "lucide-react": "^0.525.0", "next": "^15.4.3", - "next-build-id": "^3.0.0", "next-themes": "^0.4.6", "react": "19.1.0", "react-dom": "19.1.0", @@ -241,9 +240,9 @@ } }, "node_modules/@eslint/plugin-kit": { - "version": "0.3.3", - "resolved": "https://registry.npmjs.org/@eslint/plugin-kit/-/plugin-kit-0.3.3.tgz", - "integrity": "sha512-1+WqvgNMhmlAambTvT3KPtCl/Ibr68VldY2XY40SL1CE0ZXiakFR/cbTspaF5HsnpDMvcYYoJHfl4980NBjGag==", + "version": "0.3.4", + "resolved": "https://registry.npmjs.org/@eslint/plugin-kit/-/plugin-kit-0.3.4.tgz", + "integrity": "sha512-Ul5l+lHEcw3L5+k8POx6r74mxEYKG5kOb6Xpy2gCRW6zweT6TEhAf8vhxGgjhqrd/VO/Dirhsb+1hNpD1ue9hw==", "dev": true, "license": "Apache-2.0", "dependencies": { @@ -5744,15 +5743,6 @@ } } }, - "node_modules/next-build-id": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/next-build-id/-/next-build-id-3.0.0.tgz", - "integrity": "sha512-B3JCsL/9Z/wkmo3EySukQHCgx89Aw0i4LPi2MEhCboQBJ6wpkYTIu1z6hOYKuw/S1Wy8ZRqCEq0dVY/ST6jGqg==", - "license": "ISC", - "engines": { - "node": ">=8" - } - }, "node_modules/next-themes": { "version": "0.4.6", "resolved": "https://registry.npmjs.org/next-themes/-/next-themes-0.4.6.tgz", diff --git a/package.json b/package.json index f323628..2df1ac3 100644 --- a/package.json +++ b/package.json @@ -30,7 +30,6 @@ "dexie-react-hooks": "^1.1.7", "lucide-react": "^0.525.0", "next": "^15.4.3", - "next-build-id": "^3.0.0", "next-themes": "^0.4.6", "react": "19.1.0", "react-dom": "19.1.0", diff --git a/src/Dockerfile b/src/Dockerfile index bb52aa1..7ae489e 100644 --- a/src/Dockerfile +++ b/src/Dockerfile @@ -38,12 +38,9 @@ COPY . . ENV NEXT_TELEMETRY_DISABLED=1 -ARG GIT_COMMIT -ENV GIT_COMMIT=$GIT_COMMIT - -RUN echo ${GIT_COMMIT} - RUN \ + GIT_COMMIT=$(git rev-parse HEAD); \ + echo $GIT_COMMIT; \ if [ -f yarn.lock ]; then yarn run build; \ elif [ -f package-lock.json ]; then npm run build; \ elif [ -f pnpm-lock.yaml ]; then corepack enable pnpm && pnpm run build; \ diff --git a/src/app/settings/page.tsx b/src/app/settings/page.tsx index 733bc7a..e1005db 100644 --- a/src/app/settings/page.tsx +++ b/src/app/settings/page.tsx @@ -9,7 +9,7 @@ import { useIsMobile } from "@/hooks/use-mobile"; import AscendingCard from "@/components/ascending-card"; import Link from "next/link"; import WideContainer from "@/components/wide-container"; -import getBuildID from "@/lib/build"; +import { getBuildID, getVersion } from "@/lib/build"; export default function Settings(): ReactNode { @@ -47,7 +47,12 @@ export default function Settings(): ReactNode { -

Build ID: {getBuildID()}

+ + {getVersion()} ({getBuildID()}) + diff --git a/src/lib/build.ts b/src/lib/build.ts index 760b148..6e66a95 100644 --- a/src/lib/build.ts +++ b/src/lib/build.ts @@ -1,5 +1,7 @@ -const getBuildID = () => ( - process.env.NODE_ENV == "development" ? "development build" : process.env.BUILD_ID +export const getBuildID = () => ( + process.env.NODE_ENV == "development" ? "latest commit" : process.env.BUILD_ID ); -export default getBuildID; \ No newline at end of file +export const getVersion = () => ( + process.env.NODE_ENV == "development" ? "development" : process.env.VERSION +); \ No newline at end of file