chore: add CI workflow and update dependencies in package.json and vite.config.ts

This commit is contained in:
hamster1963
2026-04-02 17:17:16 +08:00
parent e4ba96ea76
commit f7662d2751
4 changed files with 480 additions and 796 deletions
+38
View File
@@ -0,0 +1,38 @@
name: CI
on:
push:
branches:
- "**"
pull_request:
concurrency:
group: ci-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
build:
name: Build Check
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Check out code
uses: actions/checkout@v4
- name: Set up pnpm
uses: pnpm/action-setup@v4
with:
version: 9
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: 22
cache: pnpm
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Run build
run: pnpm run build
+5 -5
View File
@@ -47,7 +47,7 @@
"react": "19.0.0", "react": "19.0.0",
"react-dom": "19.0.0", "react-dom": "19.0.0",
"react-i18next": "15.4.1", "react-i18next": "15.4.1",
"react-router-dom": "^7.13.0", "react-router-dom": "^7.13.2",
"recharts": "2.15.1", "recharts": "2.15.1",
"sonner": "1.7.4", "sonner": "1.7.4",
"tailwind-merge": "2.6.0", "tailwind-merge": "2.6.0",
@@ -55,15 +55,15 @@
}, },
"devDependencies": { "devDependencies": {
"@biomejs/biome": "2.3.10", "@biomejs/biome": "2.3.10",
"@tailwindcss/postcss": "^4.1.18", "@tailwindcss/postcss": "^4.2.2",
"@types/node": "22.13.4", "@types/node": "22.13.4",
"@types/react": "19.0.10", "@types/react": "19.0.10",
"@types/react-dom": "19.0.4", "@types/react-dom": "19.0.4",
"@vitejs/plugin-react-swc": "3.8.0", "@vitejs/plugin-react": "^6.0.1",
"globals": "15.15.0", "globals": "15.15.0",
"postcss": "8.5.3", "postcss": "8.5.3",
"tailwindcss": "^4.1.18", "tailwindcss": "^4.2.2",
"typescript": "~5.6.3", "typescript": "~5.6.3",
"vite": "6.4.1" "vite": "8.0.3"
} }
} }
+412 -781
View File
File diff suppressed because it is too large Load Diff
+25 -10
View File
@@ -1,7 +1,7 @@
import { execSync } from "node:child_process"; import { execSync } from "node:child_process";
import fs from "node:fs"; import fs from "node:fs";
import path from "node:path"; import path from "node:path";
import react from "@vitejs/plugin-react-swc"; import react from '@vitejs/plugin-react'
import { defineConfig } from "vite"; import { defineConfig } from "vite";
// Get git commit hash // Get git commit hash
@@ -14,6 +14,22 @@ const getGitHash = () => {
} }
}; };
const getVendorChunkName = (moduleId: string) => {
const normalizedId = moduleId.replace(/\\/g, "/");
if (!normalizedId.includes("/node_modules/")) {
return null;
}
const packagePath = normalizedId.split("/node_modules/").pop();
if (!packagePath) {
return null;
}
const packageName = packagePath.split("/")[0];
return packageName || null;
};
// https://vite.dev/config/ // https://vite.dev/config/
export default defineConfig({ export default defineConfig({
base: "/", base: "/",
@@ -48,19 +64,18 @@ export default defineConfig({
}, },
}, },
build: { build: {
rollupOptions: { rolldownOptions: {
output: { output: {
entryFileNames: `assets/[name].[hash].js`, entryFileNames: `assets/[name].[hash].js`,
chunkFileNames: `assets/[name].[hash].js`, chunkFileNames: `assets/[name].[hash].js`,
assetFileNames: `assets/[name].[hash].[ext]`, assetFileNames: `assets/[name].[hash].[ext]`,
manualChunks(id) { codeSplitting: {
if (id.includes("node_modules")) { groups: [
return id {
.toString() name: getVendorChunkName,
.split("node_modules/")[1] test: /[\\/]node_modules[\\/]/,
.split("/")[0] },
.toString(); ],
}
}, },
}, },
}, },