Parcourir la source

fix: 增加环境变量

Before il y a 9 mois
Parent
commit
3672b77b68
5 fichiers modifiés avec 36 ajouts et 29 suppressions
  1. 2 2
      .env.production
  2. 12 11
      package.json
  3. 16 15
      pnpm-lock.yaml
  4. 0 1
      src/app/[locale]/(TabBar)/[[...share]]/page.tsx
  5. 6 0
      src/app/[locale]/layout.tsx

+ 2 - 2
.env.production

@@ -1,3 +1,3 @@
-NEXT_PUBLIC_BASE_URL=http://206.168.191.124:8800
+NEXT_PUBLIC_BASE_URL=https://api.bcwin777.bet
 
-NEXT_PUBLIC_SHARE_URL=http://206.168.191.124:3000
+NEXT_PUBLIC_SHARE_URL=https://bcwin777.bet

+ 12 - 11
package.json

@@ -3,16 +3,17 @@
   "version": "0.1.0",
   "private": true,
   "scripts": {
-    "dev": "cross-env NODE_ENV=development APP_ENV=dev next dev",
-    "build:uat": "cross-env NODE_ENV=production APP_ENV=dev next build",
-
-    "dev:test": "cross-env NODE_ENV=test APP_ENV=test  next dev",
-    "build:test": "cross-env NODE_ENV=test APP_ENV=test  next build",
-    "start:test": "cross-env NODE_ENV=test APP_ENV=test next start",
-
-    "build": "cross-env NODE_ENV=production APP_ENV=pro next build",
-    "start": "cross-env NODE_ENV=production APP_ENV=pro next start",
-
+    "dev": "env-cmd -f .env.development next dev",
+    "dev:pro": "env-cmd -f .env.production next dev",
+    "build:pro": "env-cmd -f .env.production next build",
+    "start:pro": "env-cmd -f .env.production next start",
+    "dev:test": "env-cmd -f .env.test  next dev",
+    "build:test": "env-cmd -f .env.test next build",
+    "start:test": "env-cmd -f .env.test next start",
+    "dev:uat": "env-cmd -f .env.uat next dev",
+    "build:uat": "env-cmd -f .env.uat next build",
+    "start:uat": "env-cmd -f .env.uat next start",
+    "build": "env-cmd -f .env.production next build",
     "lint": "next lint",
     "preinstall": "npx only-allow pnpm"
   },
@@ -22,6 +23,7 @@
     "axios": "^1.7.2",
     "clsx": "^2.1.1",
     "dayjs": "^1.11.11",
+    "env-cmd": "^10.1.0",
     "framer-motion": "^11.3.2",
     "js-cookie": "^3.0.5",
     "next": "14.2.4",
@@ -40,7 +42,6 @@
     "@types/react": "^18.3.3",
     "@types/react-dom": "^18.3.0",
     "@types/webpack-env": "^1.18.5",
-    "cross-env": "^7.0.3",
     "eslint": "^8.57.0",
     "eslint-config-next": "14.2.4",
     "eslint-config-prettier": "^9.1.0",

+ 16 - 15
pnpm-lock.yaml

@@ -23,6 +23,9 @@ importers:
       dayjs:
         specifier: ^1.11.11
         version: 1.11.11
+      env-cmd:
+        specifier: ^10.1.0
+        version: 10.1.0
       framer-motion:
         specifier: ^11.3.2
         version: 11.3.4(react-dom@18.3.1(react@18.3.1))(react@18.3.1)
@@ -72,9 +75,6 @@ importers:
       '@types/webpack-env':
         specifier: ^1.18.5
         version: 1.18.5
-      cross-env:
-        specifier: ^7.0.3
-        version: 7.0.3
       eslint:
         specifier: ^8.57.0
         version: 8.57.0
@@ -573,11 +573,6 @@ packages:
   concat-map@0.0.1:
     resolution: {integrity: sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==}
 
-  cross-env@7.0.3:
-    resolution: {integrity: sha512-+/HKd6EgcQCJGh2PSjZuUitQBQynKor4wrFbRg4DtAgS1aWO+gU52xpH7M9ScGgXSYmAVS9bIJ8EzuaGw0oNAw==}
-    engines: {node: '>=10.14', npm: '>=6', yarn: '>=1'}
-    hasBin: true
-
   cross-spawn@7.0.3:
     resolution: {integrity: sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==}
     engines: {node: '>= 8'}
@@ -679,6 +674,11 @@ packages:
     resolution: {integrity: sha512-dwDPwZL0dmye8Txp2gzFmA6sxALaSvdRDjPH0viLcKrtlOL3tw62nWWweVD1SdILDTJrbrL6tdWVN58Wo6U3eA==}
     engines: {node: '>=10.13.0'}
 
+  env-cmd@10.1.0:
+    resolution: {integrity: sha512-mMdWTT9XKN7yNth/6N6g2GuKuJTsKMDHlQFUDacb/heQRRWOTIZ42t1rMHnQu4jYxU1ajdTeJM+9eEETlqToMA==}
+    engines: {node: '>=8.0.0'}
+    hasBin: true
+
   es-abstract@1.23.3:
     resolution: {integrity: sha512-e+HfNH61Bj1X9/jLc5v1owaLYuHdeHHSQlkhCBiTK8rBvKaULl/beGMxwrMXjpYrv4pz22BlY570vVePA2ho4A==}
     engines: {node: '>= 0.4'}
@@ -2464,10 +2464,6 @@ snapshots:
 
   concat-map@0.0.1: {}
 
-  cross-env@7.0.3:
-    dependencies:
-      cross-spawn: 7.0.3
-
   cross-spawn@7.0.3:
     dependencies:
       path-key: 3.1.1
@@ -2574,6 +2570,11 @@ snapshots:
       graceful-fs: 4.2.11
       tapable: 2.2.1
 
+  env-cmd@10.1.0:
+    dependencies:
+      commander: 4.1.1
+      cross-spawn: 7.0.3
+
   es-abstract@1.23.3:
     dependencies:
       array-buffer-byte-length: 1.0.1
@@ -2688,7 +2689,7 @@ snapshots:
       eslint: 8.57.0
       eslint-import-resolver-node: 0.3.9
       eslint-import-resolver-typescript: 3.6.1(@typescript-eslint/parser@7.2.0(eslint@8.57.0)(typescript@5.5.3))(eslint-import-resolver-node@0.3.9)(eslint-plugin-import@2.29.1(eslint@8.57.0))(eslint@8.57.0)
-      eslint-plugin-import: 2.29.1(@typescript-eslint/parser@7.2.0(eslint@8.57.0)(typescript@5.5.3))(eslint-import-resolver-typescript@3.6.1(@typescript-eslint/parser@7.2.0(eslint@8.57.0)(typescript@5.5.3))(eslint-import-resolver-node@0.3.9)(eslint-plugin-import@2.29.1(eslint@8.57.0))(eslint@8.57.0))(eslint@8.57.0)
+      eslint-plugin-import: 2.29.1(@typescript-eslint/parser@7.2.0(eslint@8.57.0)(typescript@5.5.3))(eslint-import-resolver-typescript@3.6.1)(eslint@8.57.0)
       eslint-plugin-jsx-a11y: 6.9.0(eslint@8.57.0)
       eslint-plugin-react: 7.34.4(eslint@8.57.0)
       eslint-plugin-react-hooks: 4.6.2(eslint@8.57.0)
@@ -2716,7 +2717,7 @@ snapshots:
       enhanced-resolve: 5.17.0
       eslint: 8.57.0
       eslint-module-utils: 2.8.1(@typescript-eslint/parser@7.2.0(eslint@8.57.0)(typescript@5.5.3))(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.6.1(@typescript-eslint/parser@7.2.0(eslint@8.57.0)(typescript@5.5.3))(eslint-import-resolver-node@0.3.9)(eslint-plugin-import@2.29.1(eslint@8.57.0))(eslint@8.57.0))(eslint@8.57.0)
-      eslint-plugin-import: 2.29.1(@typescript-eslint/parser@7.2.0(eslint@8.57.0)(typescript@5.5.3))(eslint-import-resolver-typescript@3.6.1(@typescript-eslint/parser@7.2.0(eslint@8.57.0)(typescript@5.5.3))(eslint-import-resolver-node@0.3.9)(eslint-plugin-import@2.29.1(eslint@8.57.0))(eslint@8.57.0))(eslint@8.57.0)
+      eslint-plugin-import: 2.29.1(@typescript-eslint/parser@7.2.0(eslint@8.57.0)(typescript@5.5.3))(eslint-import-resolver-typescript@3.6.1)(eslint@8.57.0)
       fast-glob: 3.3.2
       get-tsconfig: 4.7.5
       is-core-module: 2.14.0
@@ -2738,7 +2739,7 @@ snapshots:
     transitivePeerDependencies:
       - supports-color
 
-  eslint-plugin-import@2.29.1(@typescript-eslint/parser@7.2.0(eslint@8.57.0)(typescript@5.5.3))(eslint-import-resolver-typescript@3.6.1(@typescript-eslint/parser@7.2.0(eslint@8.57.0)(typescript@5.5.3))(eslint-import-resolver-node@0.3.9)(eslint-plugin-import@2.29.1(eslint@8.57.0))(eslint@8.57.0))(eslint@8.57.0):
+  eslint-plugin-import@2.29.1(@typescript-eslint/parser@7.2.0(eslint@8.57.0)(typescript@5.5.3))(eslint-import-resolver-typescript@3.6.1)(eslint@8.57.0):
     dependencies:
       array-includes: 3.1.8
       array.prototype.findlastindex: 1.2.5

+ 0 - 1
src/app/[locale]/(TabBar)/[[...share]]/page.tsx

@@ -20,7 +20,6 @@ const getGames = async () => {
 
 export default async function Page() {
     const group = await getGames();
-    console.log(`🚀🚀🚀🚀🚀-> in page.tsx on 23`, group);
     return (
         <>
             <HomeTabs tabs={group} />

+ 6 - 0
src/app/[locale]/layout.tsx

@@ -35,6 +35,12 @@ export const metadata = {
     },
 };
 
+console.log(
+    `🚀🚀🚀🚀🚀-> in layout.tsx on 38`,
+    process.env.NODE_ENV,
+    process.env.NEXT_PUBLIC_BASE_URL
+);
+
 export default async function LocaleLayout({
     children,
     params: { locale },