Browse Source

fix: #23 errors when dev on windows

Yidadaa 1 year ago
parent
commit
a5b3998304
3 changed files with 15 additions and 6 deletions
  1. 7 2
      app/layout.tsx
  2. 3 4
      package.json
  3. 5 0
      yarn.lock

+ 7 - 2
app/layout.tsx

@@ -1,13 +1,18 @@
+/* eslint-disable @next/next/no-page-custom-font */
 import "./styles/globals.scss";
 import "./styles/markdown.scss";
 import "./styles/prism.scss";
+import process from "child_process";
 
 export const metadata = {
   title: "ChatGPT Next Web",
-  description: "Your personal ChatGPT Chat Bot."
+  description: "Your personal ChatGPT Chat Bot.",
 };
 
-const COMMIT_ID = process.env.COMMIT_ID
+const COMMIT_ID = process
+  .execSync("git rev-parse --short HEAD")
+  .toString()
+  .trim();
 
 export default function RootLayout({
   children,

+ 3 - 4
package.json

@@ -3,9 +3,9 @@
   "version": "1.1",
   "private": false,
   "scripts": {
-    "dev": "cross-env COMMIT_ID=$(git rev-parse --short HEAD) next dev",
-    "build": "cross-env COMMIT_ID=$(git rev-parse --short HEAD) next build",
-    "start": "cross-env COMMIT_ID=$(git rev-parse --short HEAD) next start",
+    "dev": "next dev",
+    "build": "next build",
+    "start": "next start",
     "lint": "next lint"
   },
   "dependencies": {
@@ -20,7 +20,6 @@
     "eslint": "8.35.0",
     "eslint-config-next": "13.2.3",
     "eventsource-parser": "^0.1.0",
-    "git-rev-sync": "^3.0.2",
     "next": "^13.2.3",
     "openai": "^3.2.1",
     "react": "^18.2.0",

+ 5 - 0
yarn.lock

@@ -1313,6 +1313,11 @@
   dependencies:
     "@types/ms" "*"
 
+"@types/git-rev-sync@^2.0.0":
+  version "2.0.0"
+  resolved "https://registry.npmmirror.com/@types/git-rev-sync/-/git-rev-sync-2.0.0.tgz#9de6e18cb01e65f769de77175bbe93254664023e"
+  integrity sha512-qGYApbb0m8Ofy3pwYks+kYVIZQAN/cqNucJGbl5O5GpLw9JSzp74rkTWDhPv3brrJfJb5/ixtimLJpo4tfh2QA==
+
 "@types/hast@^2.0.0":
   version "2.3.4"
   resolved "https://registry.npmmirror.com/@types/hast/-/hast-2.3.4.tgz#8aa5ef92c117d20d974a82bdfb6a648b08c0bafc"