mirror of
https://github.com/ClipFusion-org/clipfusion.git
synced 2025-08-03 15:55:07 +00:00
got git commit parsing working
This commit is contained in:
parent
e79cf886dc
commit
548d8a8775
@ -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
|
||||
}
|
||||
|
||||
};
|
||||
|
16
package-lock.json
generated
16
package-lock.json
generated
@ -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",
|
||||
|
@ -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",
|
||||
|
@ -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; \
|
||||
|
@ -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 {
|
||||
<ChevronRightIcon />
|
||||
</AscendingCard>
|
||||
</Link>
|
||||
<p className="text-sm text-muted-foreground">Build ID: {getBuildID()}</p>
|
||||
<Link className="text-sm text-muted-foreground flex justify-center" target="_blank" href={
|
||||
process.env.NODE_ENV == "development"
|
||||
? "https://github.com/ClipFusion-org/clipfusion/commit/main"
|
||||
: `https://github.com/ClipFusion-org/clipfusion/commit/${process.env.BUILD_ID}`}>
|
||||
{getVersion()} ({getBuildID()})
|
||||
</Link>
|
||||
</div>
|
||||
</WideContainer>
|
||||
</div>
|
||||
|
@ -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;
|
||||
export const getVersion = () => (
|
||||
process.env.NODE_ENV == "development" ? "development" : process.env.VERSION
|
||||
);
|
Loading…
Reference in New Issue
Block a user