fix frontend process.env, cleanup (#44)

- fix `process.env` in frontend
- remove redundant frontend command "build-trends"
- remove outdated frontend/README.md
- add documentation about skipping Vercel build cache
This commit is contained in:
Martin
2026-02-07 17:51:40 +01:00
committed by GitHub
8 changed files with 70 additions and 36 deletions
+1 -1
View File
@@ -7,7 +7,7 @@ To set up the project GitHub-Stats-Extended locally, run the following commands:
```bash
./vercel-preparation.sh
pnpm install
pnpm --filter frontend run build-trends
pnpm --filter frontend run build
```
The easiest way to run and test the project is to deploy it to Vercel as described in the [deployment guide](../docs/deploy.md).
+1 -1
View File
@@ -41,7 +41,7 @@ jobs:
./vercel-preparation.sh
- name: Build frontend
run: pnpm --filter frontend run build-trends
run: pnpm --filter frontend run build
code-checks:
name: Code checks
+1 -1
View File
@@ -1,6 +1,6 @@
{
"$schema": "https://openapi.vercel.sh/vercel.json",
"buildCommand": "cd ../../ && rm -rf ./apps/backend/node_modules && pnpm --filter ./apps/backend/ --legacy deploy ./apps/deployment/ && mv ./apps/deployment/node_modules/ ./apps/backend/node_modules/ && ./vercel-preparation.sh",
"buildCommand": "cd ../../ && git clean ./apps -fx && pnpm --filter ./apps/backend/ --legacy deploy ./apps/deployment/ && mv ./apps/deployment/node_modules/ ./apps/backend/node_modules/ && ./vercel-preparation.sh",
"redirects": [
{
"source": "/",
-25
View File
@@ -1,25 +0,0 @@
# Frontend
## Installation
```
yarn install
```
## Run Locally
```
yarn start-trends
```
## Build
```
yarn build-trends
```
Then, just commit on the main branch (Vercel takes care of the rest)
## Adding a Secret
Update .env, .env-template, and Vercel.
+2 -2
View File
@@ -32,12 +32,12 @@
"postcss": "^8.4.31",
"tailwindcss": "^3.3.5",
"vite": "7.3.1",
"vite-plugin-node-polyfills": "0.25.0"
"vite-plugin-node-polyfills": "0.25.0",
"vite-plugin-string-replace": "^1.1.5"
},
"scripts": {
"dev": "vite",
"build": "vite build",
"build-trends": "vite build",
"preview": "vite preview",
"typecheck": "tsc --noEmit"
},
+2 -2
View File
@@ -1,6 +1,6 @@
{
"$schema": "https://openapi.vercel.sh/vercel.json",
"installCommand": "cd ../../ && pnpm install && rm -rf ./apps/frontend/node_modules && ./vercel-preparation.sh && pnpm --filter ./apps/frontend/ --legacy deploy ./apps/deployment/ && mv ./apps/deployment/node_modules/ ./apps/frontend/node_modules/",
"buildCommand": "pnpm run build-trends",
"installCommand": "cd ../../ && git clean ./apps -fx && pnpm install && rm -rf ./apps/frontend/node_modules && ./vercel-preparation.sh && pnpm --filter ./apps/frontend/ --legacy deploy ./apps/deployment/ && mv ./apps/deployment/node_modules/ ./apps/frontend/node_modules/",
"buildCommand": "pnpm run build",
"outputDirectory": "build"
}
+9 -4
View File
@@ -4,10 +4,19 @@ import { defineConfig } from "vite";
import { nodePolyfills } from "vite-plugin-node-polyfills";
import react from "@vitejs/plugin-react-swc";
import StringReplace from "vite-plugin-string-replace";
// https://vitejs.dev/config/
export default defineConfig({
base: "/frontend/",
plugins: [
StringReplace([
{
search: "process.env",
replace: "window.process.env",
fileName: ".*backend.*",
},
]),
nodePolyfills({
include: [
"path",
@@ -46,10 +55,6 @@ export default defineConfig({
/** @todo use chunks to split bundle? */
chunkSizeWarningLimit: 800,
},
define: {
// Prevent Vite from injecting process.env like Webpack DefinePlugin
"process.env": {},
},
resolve: {
alias: [
{
+54
View File
@@ -199,6 +199,9 @@ importers:
vite-plugin-node-polyfills:
specifier: 0.25.0
version: 0.25.0(rollup@4.55.1)(vite@7.3.1(@types/node@25.0.3)(jiti@1.21.7)(terser@5.44.1)(yaml@2.8.2))
vite-plugin-string-replace:
specifier: ^1.1.5
version: 1.1.5
packages:
@@ -1160,6 +1163,10 @@ packages:
resolution: {integrity: sha512-TeheYy0ILzBEI/CO55CP6zJCSdSWeRtGnHy8U8dWSUH4I68iqTsy7HkMktR4xakThc9jotkPQUXT4ITdbV7cHA==}
engines: {node: '>=18'}
'@sindresorhus/merge-streams@2.3.0':
resolution: {integrity: sha512-LtoMMhxAlorcGhmFYI+LhPgbPZCkgP6ra1YL604EeF6U98pLlQ3iWIGMdWSC+vWmPBWBNgmDBAhnAobLROJmwg==}
engines: {node: '>=18'}
'@sinonjs/commons@3.0.1':
resolution: {integrity: sha512-K3mCHKQ9sVh8o1C9cxkwxaOmXoAMlDxC1mYyHrjqOWEcBjYr76t96zL2zlj5dUGZ3HSw240X1qgH3Mjf1yJWpQ==}
@@ -2190,6 +2197,10 @@ packages:
resolution: {integrity: sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==}
engines: {node: '>=10'}
escape-string-regexp@5.0.0:
resolution: {integrity: sha512-/veY75JbMK4j1yjvuUxuVsiS/hr/4iHs9FTT6cgTexxdE0Ly/glccBAkloH/DofkjRbZU3bnoj38mOmhkZ0lHw==}
engines: {node: '>=12'}
eslint-plugin-jsdoc@61.7.1:
resolution: {integrity: sha512-36DpldF95MlTX//n3/naULFVt8d1cV4jmSkx7ZKrE9ikkKHAgMLesuWp1SmwpVwAs5ndIM6abKd6PeOYZUgdWg==}
engines: {node: '>=20.11.0'}
@@ -2482,6 +2493,10 @@ packages:
resolution: {integrity: sha512-DpLKbNU4WylpxJykQujfCcwYWiV/Jhm50Goo0wrVILAv5jOr9d+H+UR3PhSCD2rCCEIg0uc+G+muBTwD54JhDQ==}
engines: {node: '>= 0.4'}
globby@14.1.0:
resolution: {integrity: sha512-0Ia46fDOaT7k4og1PDW4YbodWWr3scS2vAr2lTbsplOt2WkKp0vQbkI9wKis/T5LV/dqPjO3bpS/z6GTJB82LA==}
engines: {node: '>=18'}
gopd@1.2.0:
resolution: {integrity: sha512-ZUKRh6/kUFoAiTAtTYPZJ3hw9wNxx+BIBOijnlG9PnrJsCcSjs1wyyD6vJpaYtgnzDrKYRSqf3OO6Rfa93xsRg==}
engines: {node: '>= 0.4'}
@@ -3370,6 +3385,10 @@ packages:
resolution: {integrity: sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==}
engines: {node: '>=8'}
path-type@6.0.0:
resolution: {integrity: sha512-Vj7sf++t5pBD637NSfkxpHSMfWaeig5+DKWLhcqIYx6mWQz5hdJTGDVMQiJcw1ZYkhs7AazKDGpRVji1LJCZUQ==}
engines: {node: '>=18'}
pbkdf2@3.1.5:
resolution: {integrity: sha512-Q3CG/cYvCO1ye4QKkuH7EXxs3VC/rI1/trd+qX2+PolbaKG0H+bgcZzrTt96mMyRtejk+JMCiLUn3y29W8qmFQ==}
engines: {node: '>= 0.10'}
@@ -3836,6 +3855,10 @@ packages:
resolution: {integrity: sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==}
engines: {node: '>=8'}
slash@5.1.0:
resolution: {integrity: sha512-ZA6oR3T/pEyuqwMgAKT0/hAv8oAXckzbkmR0UkUosQ+Mc4RxGoJkRmwHgHufaenlyAgE1Mxgpdcrf75y6XcnDg==}
engines: {node: '>=14.16'}
slice-ansi@7.1.2:
resolution: {integrity: sha512-iOBWFgUX7caIZiuutICxVgX1SdxwAVFFKwt1EvMYYec/NWO5meOJ6K5uQxhrYBdQJne4KxiqZc+KptFOWFSI9w==}
engines: {node: '>=18'}
@@ -4147,6 +4170,10 @@ packages:
resolution: {integrity: sha512-raqeBD6NQK4SkWhQzeYKd1KmIG6dllBOTt55Rmkt4HtI9mwdWtJljnrXjAFUBLTSN67HWrOIZ3EPF4kjUw80Bg==}
engines: {node: '>=14.0'}
unicorn-magic@0.3.0:
resolution: {integrity: sha512-+QBBXBCvifc56fsbuxZQ6Sic3wqqc3WWaqxs58gvJrcOuN83HGTCwz3oS5phzU9LthRNE9VrJCFCLUgHeeFnfA==}
engines: {node: '>=18'}
universal-user-agent@6.0.1:
resolution: {integrity: sha512-yCzhz6FN2wU1NiiQRogkTQszlQSlpWaw8SvVegAc+bDxbzHgh1vX8uIe8OYyMH6DwH+sdTJsgMl36+mSMdRJIQ==}
@@ -4201,6 +4228,9 @@ packages:
peerDependencies:
vite: ^2.0.0 || ^3.0.0 || ^4.0.0 || ^5.0.0 || ^6.0.0 || ^7.0.0
vite-plugin-string-replace@1.1.5:
resolution: {integrity: sha512-6kxox6rs/v5mbmV7BvRmSjALyYEmXC/IRBVS5ymgaV9iXe/OW84s3XNJrQX8B8/u9M/LK3gbQ6hWiYiOzqSRYQ==}
vite@7.3.1:
resolution: {integrity: sha512-w+N7Hifpc3gRjZ63vYBXA56dvvRlNWRczTdmCBBa+CotUzAPf5b7YMdMR/8CQoeYE5LX3W4wj6RYTgonm1b9DA==}
engines: {node: ^20.19.0 || >=22.12.0}
@@ -5314,6 +5344,8 @@ snapshots:
'@sindresorhus/base62@1.0.0': {}
'@sindresorhus/merge-streams@2.3.0': {}
'@sinonjs/commons@3.0.1':
dependencies:
type-detect: 4.0.8
@@ -6494,6 +6526,8 @@ snapshots:
escape-string-regexp@4.0.0: {}
escape-string-regexp@5.0.0: {}
eslint-plugin-jsdoc@61.7.1(eslint@9.39.2(jiti@2.6.1)):
dependencies:
'@es-joy/jsdoccomment': 0.78.0
@@ -6884,6 +6918,15 @@ snapshots:
define-properties: 1.2.1
gopd: 1.2.0
globby@14.1.0:
dependencies:
'@sindresorhus/merge-streams': 2.3.0
fast-glob: 3.3.3
ignore: 7.0.5
path-type: 6.0.0
slash: 5.1.0
unicorn-magic: 0.3.0
gopd@1.2.0: {}
graceful-fs@4.2.11: {}
@@ -8003,6 +8046,8 @@ snapshots:
path-type@4.0.0:
optional: true
path-type@6.0.0: {}
pbkdf2@3.1.5:
dependencies:
create-hash: 1.2.0
@@ -8517,6 +8562,8 @@ snapshots:
slash@3.0.0: {}
slash@5.1.0: {}
slice-ansi@7.1.2:
dependencies:
ansi-styles: 6.2.3
@@ -8904,6 +8951,8 @@ snapshots:
dependencies:
'@fastify/busboy': 2.1.1
unicorn-magic@0.3.0: {}
universal-user-agent@6.0.1: {}
unpipe@1.0.0: {}
@@ -8982,6 +9031,11 @@ snapshots:
transitivePeerDependencies:
- rollup
vite-plugin-string-replace@1.1.5:
dependencies:
escape-string-regexp: 5.0.0
globby: 14.1.0
vite@7.3.1(@types/node@25.0.3)(jiti@1.21.7)(terser@5.44.1)(yaml@2.8.2):
dependencies:
esbuild: 0.27.2