From 37adfddf3f1dce66f556bfa6962867444f394c6d Mon Sep 17 00:00:00 2001 From: siujamo Date: Fri, 8 May 2026 17:35:45 +0800 Subject: [PATCH 01/17] feat: add @onixbyte/vite-plugin-port-checker to enhance Vite configuration --- package.json | 1 + pnpm-lock.yaml | 26 ++++++++++++++++++++++++++ vite.config.ts | 3 ++- 3 files changed, 29 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index da3ec47..f41327e 100644 --- a/package.json +++ b/package.json @@ -27,6 +27,7 @@ "tailwindcss": "^4.2.4" }, "devDependencies": { + "@onixbyte/vite-plugin-port-checker": "^1.0.0", "@types/node": "^22.19.17", "@types/react": "^19.2.14", "@types/react-dom": "^19.2.3", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index c199610..187e16f 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -51,6 +51,9 @@ importers: specifier: ^4.2.4 version: 4.2.4 devDependencies: + '@onixbyte/vite-plugin-port-checker': + specifier: ^1.0.0 + version: 1.0.0(vite@8.0.10(@types/node@22.19.17)(esbuild@0.27.4)(jiti@2.6.1)) '@types/node': specifier: ^22.19.17 version: 22.19.17 @@ -310,6 +313,11 @@ packages: '@emnapi/core': ^1.7.1 '@emnapi/runtime': ^1.7.1 + '@onixbyte/vite-plugin-port-checker@1.0.0': + resolution: {integrity: sha512-AH44sClYQb25VjNYpGdHKRgVm+hWVLHziBY4BbuRdlZ+SN4G/7POV8QWEjW5wmZ0QrTDiixfIkwQlcy4SDsl7Q==} + peerDependencies: + vite: '>=3.0.0' + '@oxc-project/types@0.127.0': resolution: {integrity: sha512-aIYXQBo4lCbO4z0R3FHeucQHpF46l2LbMdxRvqvuRuW2OxdnSkcng5B8+K12spgLDj93rtN3+J2Vac/TIO+ciQ==} @@ -648,36 +656,42 @@ packages: engines: {node: ^20.19.0 || >=22.12.0} cpu: [arm64] os: [linux] + libc: [glibc] '@rolldown/binding-linux-arm64-musl@1.0.0-rc.17': resolution: {integrity: sha512-b/CgbwAJpmrRLp02RPfhbudf5tZnN9nsPWK82znefso832etkem8H7FSZwxrOI9djcdTP7U6YfNhbRnh7djErg==} engines: {node: ^20.19.0 || >=22.12.0} cpu: [arm64] os: [linux] + libc: [musl] '@rolldown/binding-linux-ppc64-gnu@1.0.0-rc.17': resolution: {integrity: sha512-4EII1iNGRUN5WwGbF/kOh/EIkoDN9HsupgLQoXfY+D1oyJm7/F4t5PYU5n8SWZgG0FEwakyM8pGgwcBYruGTlA==} engines: {node: ^20.19.0 || >=22.12.0} cpu: [ppc64] os: [linux] + libc: [glibc] '@rolldown/binding-linux-s390x-gnu@1.0.0-rc.17': resolution: {integrity: sha512-AH8oq3XqQo4IibpVXvPeLDI5pzkpYn0WiZAfT05kFzoJ6tQNzwRdDYQ45M8I/gslbodRZwW8uxLhbSBbkv96rA==} engines: {node: ^20.19.0 || >=22.12.0} cpu: [s390x] os: [linux] + libc: [glibc] '@rolldown/binding-linux-x64-gnu@1.0.0-rc.17': resolution: {integrity: sha512-cLnjV3xfo7KslbU41Z7z8BH/E1y5mzUYzAqih1d1MDaIGZRCMqTijqLv76/P7fyHuvUcfGsIpqCdddbxLLK9rA==} engines: {node: ^20.19.0 || >=22.12.0} cpu: [x64] os: [linux] + libc: [glibc] '@rolldown/binding-linux-x64-musl@1.0.0-rc.17': resolution: {integrity: sha512-0phclDw1spsL7dUB37sIARuis2tAgomCJXAHZlpt8PXZ4Ba0dRP1e+66lsRqrfhISeN9bEGNjQs+T/Fbd7oYGw==} engines: {node: ^20.19.0 || >=22.12.0} cpu: [x64] os: [linux] + libc: [musl] '@rolldown/binding-openharmony-arm64@1.0.0-rc.17': resolution: {integrity: sha512-0ag/hEgXOwgw4t8QyQvUCxvEg+V0KBcA6YuOx9g0r02MprutRF5dyljgm3EmR02O292UX7UeS6HzWHAl6KgyhA==} @@ -752,24 +766,28 @@ packages: engines: {node: '>= 20'} cpu: [arm64] os: [linux] + libc: [glibc] '@tailwindcss/oxide-linux-arm64-musl@4.2.4': resolution: {integrity: sha512-bBADEGAbo4ASnppIziaQJelekCxdMaxisrk+fB7Thit72IBnALp9K6ffA2G4ruj90G9XRS2VQ6q2bCKbfFV82g==} engines: {node: '>= 20'} cpu: [arm64] os: [linux] + libc: [musl] '@tailwindcss/oxide-linux-x64-gnu@4.2.4': resolution: {integrity: sha512-7Mx25E4WTfnht0TVRTyC00j3i0M+EeFe7wguMDTlX4mRxafznw0CA8WJkFjWYH5BlgELd1kSjuU2JiPnNZbJDA==} engines: {node: '>= 20'} cpu: [x64] os: [linux] + libc: [glibc] '@tailwindcss/oxide-linux-x64-musl@4.2.4': resolution: {integrity: sha512-2wwJRF7nyhOR0hhHoChc04xngV3iS+akccHTGtz965FwF0up4b2lOdo6kI1EbDaEXKgvcrFBYcYQQ/rrnWFVfA==} engines: {node: '>= 20'} cpu: [x64] os: [linux] + libc: [musl] '@tailwindcss/oxide-wasm32-wasi@4.2.4': resolution: {integrity: sha512-FQsqApeor8Fo6gUEklzmaa9994orJZZDBAlQpK2Mq+DslRKFJeD6AjHpBQ0kZFQohVr8o85PPh8eOy86VlSCmw==} @@ -1026,24 +1044,28 @@ packages: engines: {node: '>= 12.0.0'} cpu: [arm64] os: [linux] + libc: [glibc] lightningcss-linux-arm64-musl@1.32.0: resolution: {integrity: sha512-UpQkoenr4UJEzgVIYpI80lDFvRmPVg6oqboNHfoH4CQIfNA+HOrZ7Mo7KZP02dC6LjghPQJeBsvXhJod/wnIBg==} engines: {node: '>= 12.0.0'} cpu: [arm64] os: [linux] + libc: [musl] lightningcss-linux-x64-gnu@1.32.0: resolution: {integrity: sha512-V7Qr52IhZmdKPVr+Vtw8o+WLsQJYCTd8loIfpDaMRWGUZfBOYEJeyJIkqGIDMZPwPx24pUMfwSxxI8phr/MbOA==} engines: {node: '>= 12.0.0'} cpu: [x64] os: [linux] + libc: [glibc] lightningcss-linux-x64-musl@1.32.0: resolution: {integrity: sha512-bYcLp+Vb0awsiXg/80uCRezCYHNg1/l3mt0gzHnWV9XP1W5sKa5/TCdGWaR/zBM2PeF/HbsQv/j2URNOiVuxWg==} engines: {node: '>= 12.0.0'} cpu: [x64] os: [linux] + libc: [musl] lightningcss-win32-arm64-msvc@1.32.0: resolution: {integrity: sha512-8SbC8BR40pS6baCM8sbtYDSwEVQd4JlFTOlaD3gWGHfThTcABnNDBda6eTZeqbofalIJhFx0qKzgHJmcPTnGdw==} @@ -1434,6 +1456,10 @@ snapshots: '@tybys/wasm-util': 0.10.1 optional: true + '@onixbyte/vite-plugin-port-checker@1.0.0(vite@8.0.10(@types/node@22.19.17)(esbuild@0.27.4)(jiti@2.6.1))': + dependencies: + vite: 8.0.10(@types/node@22.19.17)(esbuild@0.27.4)(jiti@2.6.1) + '@oxc-project/types@0.127.0': {} '@rc-component/async-validator@5.1.0': diff --git a/vite.config.ts b/vite.config.ts index f4ce05d..7dedc20 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -2,10 +2,11 @@ import { fileURLToPath, URL } from "node:url" import { defineConfig } from "vite" import react from "@vitejs/plugin-react" import tailwindcss from "@tailwindcss/vite" +import portChecker from "@onixbyte/vite-plugin-port-checker" // https://vite.dev/config/ export default defineConfig({ - plugins: [react(), tailwindcss()], + plugins: [react(), tailwindcss(), portChecker()], base: "/", build: { rolldownOptions: { From 26bca96575eda58540fadd2895a484168bb0f243 Mon Sep 17 00:00:00 2001 From: zihluwang Date: Sun, 10 May 2026 13:29:55 +0800 Subject: [PATCH 02/17] chore: add dependency vite-plugin-port-checker for checking listening ports --- package.json | 3 +- pnpm-lock.yaml | 312 +++++--------------------------------------- pnpm-workspace.yaml | 2 + 3 files changed, 38 insertions(+), 279 deletions(-) create mode 100644 pnpm-workspace.yaml diff --git a/package.json b/package.json index 7aff3de..d7411c5 100644 --- a/package.json +++ b/package.json @@ -34,7 +34,8 @@ "globals": "^17.6.0", "prettier": "^3.8.3", "typescript": "~6.0.3", - "vite": "^8.0.11" + "vite": "^8.0.11", + "vite-plugin-port-checker": "^1.0.1" }, "pnpm": { "ignoredBuiltDependencies": [ diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index b6e8d6d..9796d18 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -16,7 +16,7 @@ importers: version: 2.11.2(react-redux@9.2.0(@types/react@19.2.14)(react@19.2.6)(redux@5.0.1))(react@19.2.6) '@tailwindcss/vite': specifier: ^4.2.4 - version: 4.2.4(vite@8.0.11(@types/node@22.19.17)(esbuild@0.27.4)(jiti@2.6.1)) + version: 4.2.4(vite@8.0.11(@types/node@22.19.17)(jiti@2.6.1)) '@tanstack/react-virtual': specifier: ^3.13.24 version: 3.13.24(react-dom@19.2.6(react@19.2.6))(react@19.2.6) @@ -62,7 +62,7 @@ importers: version: 19.2.3(@types/react@19.2.14) '@vitejs/plugin-react': specifier: ^6.0.1 - version: 6.0.1(vite@8.0.11(@types/node@22.19.17)(esbuild@0.27.4)(jiti@2.6.1)) + version: 6.0.1(vite@8.0.11(@types/node@22.19.17)(jiti@2.6.1)) globals: specifier: ^17.6.0 version: 17.6.0 @@ -74,7 +74,10 @@ importers: version: 6.0.3 vite: specifier: ^8.0.11 - version: 8.0.11(@types/node@22.19.17)(esbuild@0.27.4)(jiti@2.6.1) + version: 8.0.11(@types/node@22.19.17)(jiti@2.6.1) + vite-plugin-port-checker: + specifier: ^1.0.1 + version: 1.0.1(vite@8.0.11(@types/node@22.19.17)(jiti@2.6.1)) packages: @@ -132,162 +135,6 @@ packages: '@emotion/unitless@0.7.5': resolution: {integrity: sha512-OWORNpfjMsSSUBVrRBVGECkhWcULOAJz9ZW8uK9qgxD+87M7jHRcvh/A96XXNhXTLmKcoYSQtBEX7lHMO7YRwg==} - '@esbuild/aix-ppc64@0.27.4': - resolution: {integrity: sha512-cQPwL2mp2nSmHHJlCyoXgHGhbEPMrEEU5xhkcy3Hs/O7nGZqEpZ2sUtLaL9MORLtDfRvVl2/3PAuEkYZH0Ty8Q==} - engines: {node: '>=18'} - cpu: [ppc64] - os: [aix] - - '@esbuild/android-arm64@0.27.4': - resolution: {integrity: sha512-gdLscB7v75wRfu7QSm/zg6Rx29VLdy9eTr2t44sfTW7CxwAtQghZ4ZnqHk3/ogz7xao0QAgrkradbBzcqFPasw==} - engines: {node: '>=18'} - cpu: [arm64] - os: [android] - - '@esbuild/android-arm@0.27.4': - resolution: {integrity: sha512-X9bUgvxiC8CHAGKYufLIHGXPJWnr0OCdR0anD2e21vdvgCI8lIfqFbnoeOz7lBjdrAGUhqLZLcQo6MLhTO2DKQ==} - engines: {node: '>=18'} - cpu: [arm] - os: [android] - - '@esbuild/android-x64@0.27.4': - resolution: {integrity: sha512-PzPFnBNVF292sfpfhiyiXCGSn9HZg5BcAz+ivBuSsl6Rk4ga1oEXAamhOXRFyMcjwr2DVtm40G65N3GLeH1Lvw==} - engines: {node: '>=18'} - cpu: [x64] - os: [android] - - '@esbuild/darwin-arm64@0.27.4': - resolution: {integrity: sha512-b7xaGIwdJlht8ZFCvMkpDN6uiSmnxxK56N2GDTMYPr2/gzvfdQN8rTfBsvVKmIVY/X7EM+/hJKEIbbHs9oA4tQ==} - engines: {node: '>=18'} - cpu: [arm64] - os: [darwin] - - '@esbuild/darwin-x64@0.27.4': - resolution: {integrity: sha512-sR+OiKLwd15nmCdqpXMnuJ9W2kpy0KigzqScqHI3Hqwr7IXxBp3Yva+yJwoqh7rE8V77tdoheRYataNKL4QrPw==} - engines: {node: '>=18'} - cpu: [x64] - os: [darwin] - - '@esbuild/freebsd-arm64@0.27.4': - resolution: {integrity: sha512-jnfpKe+p79tCnm4GVav68A7tUFeKQwQyLgESwEAUzyxk/TJr4QdGog9sqWNcUbr/bZt/O/HXouspuQDd9JxFSw==} - engines: {node: '>=18'} - cpu: [arm64] - os: [freebsd] - - '@esbuild/freebsd-x64@0.27.4': - resolution: {integrity: sha512-2kb4ceA/CpfUrIcTUl1wrP/9ad9Atrp5J94Lq69w7UwOMolPIGrfLSvAKJp0RTvkPPyn6CIWrNy13kyLikZRZQ==} - engines: {node: '>=18'} - cpu: [x64] - os: [freebsd] - - '@esbuild/linux-arm64@0.27.4': - resolution: {integrity: sha512-7nQOttdzVGth1iz57kxg9uCz57dxQLHWxopL6mYuYthohPKEK0vU0C3O21CcBK6KDlkYVcnDXY099HcCDXd9dA==} - engines: {node: '>=18'} - cpu: [arm64] - os: [linux] - - '@esbuild/linux-arm@0.27.4': - resolution: {integrity: sha512-aBYgcIxX/wd5n2ys0yESGeYMGF+pv6g0DhZr3G1ZG4jMfruU9Tl1i2Z+Wnj9/KjGz1lTLCcorqE2viePZqj4Eg==} - engines: {node: '>=18'} - cpu: [arm] - os: [linux] - - '@esbuild/linux-ia32@0.27.4': - resolution: {integrity: sha512-oPtixtAIzgvzYcKBQM/qZ3R+9TEUd1aNJQu0HhGyqtx6oS7qTpvjheIWBbes4+qu1bNlo2V4cbkISr8q6gRBFA==} - engines: {node: '>=18'} - cpu: [ia32] - os: [linux] - - '@esbuild/linux-loong64@0.27.4': - resolution: {integrity: sha512-8mL/vh8qeCoRcFH2nM8wm5uJP+ZcVYGGayMavi8GmRJjuI3g1v6Z7Ni0JJKAJW+m0EtUuARb6Lmp4hMjzCBWzA==} - engines: {node: '>=18'} - cpu: [loong64] - os: [linux] - - '@esbuild/linux-mips64el@0.27.4': - resolution: {integrity: sha512-1RdrWFFiiLIW7LQq9Q2NES+HiD4NyT8Itj9AUeCl0IVCA459WnPhREKgwrpaIfTOe+/2rdntisegiPWn/r/aAw==} - engines: {node: '>=18'} - cpu: [mips64el] - os: [linux] - - '@esbuild/linux-ppc64@0.27.4': - resolution: {integrity: sha512-tLCwNG47l3sd9lpfyx9LAGEGItCUeRCWeAx6x2Jmbav65nAwoPXfewtAdtbtit/pJFLUWOhpv0FpS6GQAmPrHA==} - engines: {node: '>=18'} - cpu: [ppc64] - os: [linux] - - '@esbuild/linux-riscv64@0.27.4': - resolution: {integrity: sha512-BnASypppbUWyqjd1KIpU4AUBiIhVr6YlHx/cnPgqEkNoVOhHg+YiSVxM1RLfiy4t9cAulbRGTNCKOcqHrEQLIw==} - engines: {node: '>=18'} - cpu: [riscv64] - os: [linux] - - '@esbuild/linux-s390x@0.27.4': - resolution: {integrity: sha512-+eUqgb/Z7vxVLezG8bVB9SfBie89gMueS+I0xYh2tJdw3vqA/0ImZJ2ROeWwVJN59ihBeZ7Tu92dF/5dy5FttA==} - engines: {node: '>=18'} - cpu: [s390x] - os: [linux] - - '@esbuild/linux-x64@0.27.4': - resolution: {integrity: sha512-S5qOXrKV8BQEzJPVxAwnryi2+Iq5pB40gTEIT69BQONqR7JH1EPIcQ/Uiv9mCnn05jff9umq/5nqzxlqTOg9NA==} - engines: {node: '>=18'} - cpu: [x64] - os: [linux] - - '@esbuild/netbsd-arm64@0.27.4': - resolution: {integrity: sha512-xHT8X4sb0GS8qTqiwzHqpY00C95DPAq7nAwX35Ie/s+LO9830hrMd3oX0ZMKLvy7vsonee73x0lmcdOVXFzd6Q==} - engines: {node: '>=18'} - cpu: [arm64] - os: [netbsd] - - '@esbuild/netbsd-x64@0.27.4': - resolution: {integrity: sha512-RugOvOdXfdyi5Tyv40kgQnI0byv66BFgAqjdgtAKqHoZTbTF2QqfQrFwa7cHEORJf6X2ht+l9ABLMP0dnKYsgg==} - engines: {node: '>=18'} - cpu: [x64] - os: [netbsd] - - '@esbuild/openbsd-arm64@0.27.4': - resolution: {integrity: sha512-2MyL3IAaTX+1/qP0O1SwskwcwCoOI4kV2IBX1xYnDDqthmq5ArrW94qSIKCAuRraMgPOmG0RDTA74mzYNQA9ow==} - engines: {node: '>=18'} - cpu: [arm64] - os: [openbsd] - - '@esbuild/openbsd-x64@0.27.4': - resolution: {integrity: sha512-u8fg/jQ5aQDfsnIV6+KwLOf1CmJnfu1ShpwqdwC0uA7ZPwFws55Ngc12vBdeUdnuWoQYx/SOQLGDcdlfXhYmXQ==} - engines: {node: '>=18'} - cpu: [x64] - os: [openbsd] - - '@esbuild/openharmony-arm64@0.27.4': - resolution: {integrity: sha512-JkTZrl6VbyO8lDQO3yv26nNr2RM2yZzNrNHEsj9bm6dOwwu9OYN28CjzZkH57bh4w0I2F7IodpQvUAEd1mbWXg==} - engines: {node: '>=18'} - cpu: [arm64] - os: [openharmony] - - '@esbuild/sunos-x64@0.27.4': - resolution: {integrity: sha512-/gOzgaewZJfeJTlsWhvUEmUG4tWEY2Spp5M20INYRg2ZKl9QPO3QEEgPeRtLjEWSW8FilRNacPOg8R1uaYkA6g==} - engines: {node: '>=18'} - cpu: [x64] - os: [sunos] - - '@esbuild/win32-arm64@0.27.4': - resolution: {integrity: sha512-Z9SExBg2y32smoDQdf1HRwHRt6vAHLXcxD2uGgO/v2jK7Y718Ix4ndsbNMU/+1Qiem9OiOdaqitioZwxivhXYg==} - engines: {node: '>=18'} - cpu: [arm64] - os: [win32] - - '@esbuild/win32-ia32@0.27.4': - resolution: {integrity: sha512-DAyGLS0Jz5G5iixEbMHi5KdiApqHBWMGzTtMiJ72ZOLhbu/bzxgAe8Ue8CTS3n3HbIUHQz/L51yMdGMeoxXNJw==} - engines: {node: '>=18'} - cpu: [ia32] - os: [win32] - - '@esbuild/win32-x64@0.27.4': - resolution: {integrity: sha512-+knoa0BDoeXgkNvvV1vvbZX4+hizelrkwmGJBdT17t8FNPwG2lKemmuMZlmaNQ3ws3DKKCxpb4zRZEIp3UxFCg==} - engines: {node: '>=18'} - cpu: [x64] - os: [win32] - '@jridgewell/gen-mapping@0.3.13': resolution: {integrity: sha512-2kkt/7niJ6MgEPxF0bYdQ6etZaA+fQvDcLKckhy1yIQOzaoKjBBjSj63/aLVjYE3qhRt5dvM+uUyfCg6UKCBbA==} @@ -648,36 +495,42 @@ packages: engines: {node: ^20.19.0 || >=22.12.0} cpu: [arm64] os: [linux] + libc: [glibc] '@rolldown/binding-linux-arm64-musl@1.0.0-rc.18': resolution: {integrity: sha512-QWjdxN1HJCpBTAcZ5N5F7wju3gVPzRzSpmGzx7na0c/1qpN9CFil+xt+l9lV/1M6/gqHSNXCiqPfwhVJPeLnug==} engines: {node: ^20.19.0 || >=22.12.0} cpu: [arm64] os: [linux] + libc: [musl] '@rolldown/binding-linux-ppc64-gnu@1.0.0-rc.18': resolution: {integrity: sha512-ugCOyj7a4d9h3q9B+wXmf6g3a68UsjGh6dob5DHevHGMwDUbhsYNbSPxJsENcIttJZ9jv7qGM2UesLw5jqIhdg==} engines: {node: ^20.19.0 || >=22.12.0} cpu: [ppc64] os: [linux] + libc: [glibc] '@rolldown/binding-linux-s390x-gnu@1.0.0-rc.18': resolution: {integrity: sha512-kKWRhbsotpXkGbcd5dllUWg5gEXcDAa8u5YnP9AV5DYNbvJHGzzuwv7dpmhc8NqKMJldl0a+x76IHbspEpEmdA==} engines: {node: ^20.19.0 || >=22.12.0} cpu: [s390x] os: [linux] + libc: [glibc] '@rolldown/binding-linux-x64-gnu@1.0.0-rc.18': resolution: {integrity: sha512-uCo8ElcCIAMyYAZyuIZ81oFkhTSIllNvUCHCAlbhlN4ji3uC28h7IIdlXyIvGO7HsuqnV9p3rD/bpH7XhIyhRw==} engines: {node: ^20.19.0 || >=22.12.0} cpu: [x64] os: [linux] + libc: [glibc] '@rolldown/binding-linux-x64-musl@1.0.0-rc.18': resolution: {integrity: sha512-XNOQZtuE6yUIvx4rwGemwh8kpL1xvU41FXy/s9K7T/3JVcqGzo3NfKM2HrbrGgfPYGFW42f07Wk++aOC6B9NWA==} engines: {node: ^20.19.0 || >=22.12.0} cpu: [x64] os: [linux] + libc: [musl] '@rolldown/binding-openharmony-arm64@1.0.0-rc.18': resolution: {integrity: sha512-tSn/kzrfa7tNOXr7sEacDBN4YsIqTyLqh45IO0nHDwtpKIDNDJr+VFojt+4klSpChxB29JLyduSsE0MKEwa65A==} @@ -752,24 +605,28 @@ packages: engines: {node: '>= 20'} cpu: [arm64] os: [linux] + libc: [glibc] '@tailwindcss/oxide-linux-arm64-musl@4.2.4': resolution: {integrity: sha512-bBADEGAbo4ASnppIziaQJelekCxdMaxisrk+fB7Thit72IBnALp9K6ffA2G4ruj90G9XRS2VQ6q2bCKbfFV82g==} engines: {node: '>= 20'} cpu: [arm64] os: [linux] + libc: [musl] '@tailwindcss/oxide-linux-x64-gnu@4.2.4': resolution: {integrity: sha512-7Mx25E4WTfnht0TVRTyC00j3i0M+EeFe7wguMDTlX4mRxafznw0CA8WJkFjWYH5BlgELd1kSjuU2JiPnNZbJDA==} engines: {node: '>= 20'} cpu: [x64] os: [linux] + libc: [glibc] '@tailwindcss/oxide-linux-x64-musl@4.2.4': resolution: {integrity: sha512-2wwJRF7nyhOR0hhHoChc04xngV3iS+akccHTGtz965FwF0up4b2lOdo6kI1EbDaEXKgvcrFBYcYQQ/rrnWFVfA==} engines: {node: '>= 20'} cpu: [x64] os: [linux] + libc: [musl] '@tailwindcss/oxide-wasm32-wasi@4.2.4': resolution: {integrity: sha512-FQsqApeor8Fo6gUEklzmaa9994orJZZDBAlQpK2Mq+DslRKFJeD6AjHpBQ0kZFQohVr8o85PPh8eOy86VlSCmw==} @@ -912,11 +769,6 @@ packages: resolution: {integrity: sha512-j6vWzfrGVfyXxge+O0x5sh6cvxAog0a/4Rdd2K36zCMV5eJ+/+tOAngRO8cODMNWbVRdVlmGZQL2YS3yR8bIUA==} engines: {node: '>= 0.4'} - esbuild@0.27.4: - resolution: {integrity: sha512-Rq4vbHnYkK5fws5NF7MYTU68FPRE1ajX7heQ/8QXXWqNgqqJ/GkmmyxIzUnf2Sr/bakf8l54716CcMGHYhMrrQ==} - engines: {node: '>=18'} - hasBin: true - fdir@6.5.0: resolution: {integrity: sha512-tIbYtZbucOs0BRGqPJkshJUYdL+SDH7dVM8gjy+ERp3WAUjLEFJE+02kanyHtwjWOnwrKYBiwAmM0p4kLJAnXg==} engines: {node: '>=12.0.0'} @@ -1026,24 +878,28 @@ packages: engines: {node: '>= 12.0.0'} cpu: [arm64] os: [linux] + libc: [glibc] lightningcss-linux-arm64-musl@1.32.0: resolution: {integrity: sha512-UpQkoenr4UJEzgVIYpI80lDFvRmPVg6oqboNHfoH4CQIfNA+HOrZ7Mo7KZP02dC6LjghPQJeBsvXhJod/wnIBg==} engines: {node: '>= 12.0.0'} cpu: [arm64] os: [linux] + libc: [musl] lightningcss-linux-x64-gnu@1.32.0: resolution: {integrity: sha512-V7Qr52IhZmdKPVr+Vtw8o+WLsQJYCTd8loIfpDaMRWGUZfBOYEJeyJIkqGIDMZPwPx24pUMfwSxxI8phr/MbOA==} engines: {node: '>= 12.0.0'} cpu: [x64] os: [linux] + libc: [glibc] lightningcss-linux-x64-musl@1.32.0: resolution: {integrity: sha512-bYcLp+Vb0awsiXg/80uCRezCYHNg1/l3mt0gzHnWV9XP1W5sKa5/TCdGWaR/zBM2PeF/HbsQv/j2URNOiVuxWg==} engines: {node: '>= 12.0.0'} cpu: [x64] os: [linux] + libc: [musl] lightningcss-win32-arm64-msvc@1.32.0: resolution: {integrity: sha512-8SbC8BR40pS6baCM8sbtYDSwEVQd4JlFTOlaD3gWGHfThTcABnNDBda6eTZeqbofalIJhFx0qKzgHJmcPTnGdw==} @@ -1217,6 +1073,11 @@ packages: peerDependencies: react: ^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0 + vite-plugin-port-checker@1.0.1: + resolution: {integrity: sha512-Mx/Pj5zyu4oak+SKGwQyRLGAvnp9zx0nqjCLhaJoGJeZk2t4EarZojTcHGG0gPMJWj9X6c0MIfzaZDslg80/GA==} + peerDependencies: + vite: '>=3.0.0' + vite@8.0.11: resolution: {integrity: sha512-Jz1mxtUBR5xTT65VOdJZUUeoyLtqljmFkiUXhPTLZka3RDc9vpi/xXkyrnsdRcm2lIi3l3GPMnAidTsEGIj3Ow==} engines: {node: ^20.19.0 || >=22.12.0} @@ -1330,84 +1191,6 @@ snapshots: '@emotion/unitless@0.7.5': {} - '@esbuild/aix-ppc64@0.27.4': - optional: true - - '@esbuild/android-arm64@0.27.4': - optional: true - - '@esbuild/android-arm@0.27.4': - optional: true - - '@esbuild/android-x64@0.27.4': - optional: true - - '@esbuild/darwin-arm64@0.27.4': - optional: true - - '@esbuild/darwin-x64@0.27.4': - optional: true - - '@esbuild/freebsd-arm64@0.27.4': - optional: true - - '@esbuild/freebsd-x64@0.27.4': - optional: true - - '@esbuild/linux-arm64@0.27.4': - optional: true - - '@esbuild/linux-arm@0.27.4': - optional: true - - '@esbuild/linux-ia32@0.27.4': - optional: true - - '@esbuild/linux-loong64@0.27.4': - optional: true - - '@esbuild/linux-mips64el@0.27.4': - optional: true - - '@esbuild/linux-ppc64@0.27.4': - optional: true - - '@esbuild/linux-riscv64@0.27.4': - optional: true - - '@esbuild/linux-s390x@0.27.4': - optional: true - - '@esbuild/linux-x64@0.27.4': - optional: true - - '@esbuild/netbsd-arm64@0.27.4': - optional: true - - '@esbuild/netbsd-x64@0.27.4': - optional: true - - '@esbuild/openbsd-arm64@0.27.4': - optional: true - - '@esbuild/openbsd-x64@0.27.4': - optional: true - - '@esbuild/openharmony-arm64@0.27.4': - optional: true - - '@esbuild/sunos-x64@0.27.4': - optional: true - - '@esbuild/win32-arm64@0.27.4': - optional: true - - '@esbuild/win32-ia32@0.27.4': - optional: true - - '@esbuild/win32-x64@0.27.4': - optional: true - '@jridgewell/gen-mapping@0.3.13': dependencies: '@jridgewell/sourcemap-codec': 1.5.5 @@ -1919,12 +1702,12 @@ snapshots: '@tailwindcss/oxide-win32-arm64-msvc': 4.2.4 '@tailwindcss/oxide-win32-x64-msvc': 4.2.4 - '@tailwindcss/vite@4.2.4(vite@8.0.11(@types/node@22.19.17)(esbuild@0.27.4)(jiti@2.6.1))': + '@tailwindcss/vite@4.2.4(vite@8.0.11(@types/node@22.19.17)(jiti@2.6.1))': dependencies: '@tailwindcss/node': 4.2.4 '@tailwindcss/oxide': 4.2.4 tailwindcss: 4.2.4 - vite: 8.0.11(@types/node@22.19.17)(esbuild@0.27.4)(jiti@2.6.1) + vite: 8.0.11(@types/node@22.19.17)(jiti@2.6.1) '@tanstack/react-virtual@3.13.24(react-dom@19.2.6(react@19.2.6))(react@19.2.6)': dependencies: @@ -1953,10 +1736,10 @@ snapshots: '@types/use-sync-external-store@0.0.6': {} - '@vitejs/plugin-react@6.0.1(vite@8.0.11(@types/node@22.19.17)(esbuild@0.27.4)(jiti@2.6.1))': + '@vitejs/plugin-react@6.0.1(vite@8.0.11(@types/node@22.19.17)(jiti@2.6.1))': dependencies: '@rolldown/pluginutils': 1.0.0-rc.7 - vite: 8.0.11(@types/node@22.19.17)(esbuild@0.27.4)(jiti@2.6.1) + vite: 8.0.11(@types/node@22.19.17)(jiti@2.6.1) antd@6.3.7(react-dom@19.2.6(react@19.2.6))(react@19.2.6): dependencies: @@ -2074,36 +1857,6 @@ snapshots: has-tostringtag: 1.0.2 hasown: 2.0.3 - esbuild@0.27.4: - optionalDependencies: - '@esbuild/aix-ppc64': 0.27.4 - '@esbuild/android-arm': 0.27.4 - '@esbuild/android-arm64': 0.27.4 - '@esbuild/android-x64': 0.27.4 - '@esbuild/darwin-arm64': 0.27.4 - '@esbuild/darwin-x64': 0.27.4 - '@esbuild/freebsd-arm64': 0.27.4 - '@esbuild/freebsd-x64': 0.27.4 - '@esbuild/linux-arm': 0.27.4 - '@esbuild/linux-arm64': 0.27.4 - '@esbuild/linux-ia32': 0.27.4 - '@esbuild/linux-loong64': 0.27.4 - '@esbuild/linux-mips64el': 0.27.4 - '@esbuild/linux-ppc64': 0.27.4 - '@esbuild/linux-riscv64': 0.27.4 - '@esbuild/linux-s390x': 0.27.4 - '@esbuild/linux-x64': 0.27.4 - '@esbuild/netbsd-arm64': 0.27.4 - '@esbuild/netbsd-x64': 0.27.4 - '@esbuild/openbsd-arm64': 0.27.4 - '@esbuild/openbsd-x64': 0.27.4 - '@esbuild/openharmony-arm64': 0.27.4 - '@esbuild/sunos-x64': 0.27.4 - '@esbuild/win32-arm64': 0.27.4 - '@esbuild/win32-ia32': 0.27.4 - '@esbuild/win32-x64': 0.27.4 - optional: true - fdir@6.5.0(picomatch@4.0.4): optionalDependencies: picomatch: 4.0.4 @@ -2347,7 +2100,11 @@ snapshots: dependencies: react: 19.2.6 - vite@8.0.11(@types/node@22.19.17)(esbuild@0.27.4)(jiti@2.6.1): + vite-plugin-port-checker@1.0.1(vite@8.0.11(@types/node@22.19.17)(jiti@2.6.1)): + dependencies: + vite: 8.0.11(@types/node@22.19.17)(jiti@2.6.1) + + vite@8.0.11(@types/node@22.19.17)(jiti@2.6.1): dependencies: lightningcss: 1.32.0 picomatch: 4.0.4 @@ -2356,6 +2113,5 @@ snapshots: tinyglobby: 0.2.16 optionalDependencies: '@types/node': 22.19.17 - esbuild: 0.27.4 fsevents: 2.3.3 jiti: 2.6.1 diff --git a/pnpm-workspace.yaml b/pnpm-workspace.yaml new file mode 100644 index 0000000..49c0ad7 --- /dev/null +++ b/pnpm-workspace.yaml @@ -0,0 +1,2 @@ +allowBuilds: + esbuild: false From 57907501245f44e5e3c19426c42492c48c697c68 Mon Sep 17 00:00:00 2001 From: zihluwang Date: Sun, 10 May 2026 13:30:25 +0800 Subject: [PATCH 03/17] feat: implemented listening port check by vite-plugin-port-checker --- vite.config.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/vite.config.ts b/vite.config.ts index f4ce05d..dde1d6d 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -2,10 +2,11 @@ import { fileURLToPath, URL } from "node:url" import { defineConfig } from "vite" import react from "@vitejs/plugin-react" import tailwindcss from "@tailwindcss/vite" +import portChecker from "vite-plugin-port-checker" // https://vite.dev/config/ export default defineConfig({ - plugins: [react(), tailwindcss()], + plugins: [react(), tailwindcss(), portChecker()], base: "/", build: { rolldownOptions: { From 5502643466a4c7638b8427c910041e80bd938165 Mon Sep 17 00:00:00 2001 From: zihluwang Date: Sun, 10 May 2026 13:30:51 +0800 Subject: [PATCH 04/17] refactor: change the modification display order --- src/page/mod-codes/index.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/page/mod-codes/index.tsx b/src/page/mod-codes/index.tsx index e3afcd1..9ad08cd 100644 --- a/src/page/mod-codes/index.tsx +++ b/src/page/mod-codes/index.tsx @@ -56,7 +56,7 @@ export default function ModCodesPage() { page: page - 1, size: pageSize, sortBy: "id", - direction: "ASC", + direction: "DESC", firearmId, tags: selectedTags, }).then((pagedData) => { From 3b5153f386223da5ee0d63bf554e397c8d0067bf Mon Sep 17 00:00:00 2001 From: zihluwang Date: Sun, 10 May 2026 13:32:49 +0800 Subject: [PATCH 05/17] refactor: add a built-in slot --- src/constant/slots.json | 1 + 1 file changed, 1 insertion(+) diff --git a/src/constant/slots.json b/src/constant/slots.json index f954e2b..cd30010 100644 --- a/src/constant/slots.json +++ b/src/constant/slots.json @@ -16,6 +16,7 @@ "枪托套件", "前握把", "后握把", + "后握贴片", "导轨脚架", "弹匣", "弹匣座", From 13242deb6c120a3dc1eaa34427efa3e17d524c90 Mon Sep 17 00:00:00 2001 From: zihluwang Date: Sun, 10 May 2026 13:41:37 +0800 Subject: [PATCH 06/17] refactor: reduce slots --- src/constant/slots.json | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/constant/slots.json b/src/constant/slots.json index cd30010..a4dc3cb 100644 --- a/src/constant/slots.json +++ b/src/constant/slots.json @@ -3,11 +3,7 @@ "左导轨", "右导轨", "枪管", - "左贴片", - "右贴片", - "上导轨", - "上贴片", - "下导轨", + "贴片", "瞄准镜", "战术设备", "增高座瞄具", From 1f30f70f2121b2b4232bf57b9c3aa1504a6ae45a Mon Sep 17 00:00:00 2001 From: zihluwang Date: Sun, 10 May 2026 13:43:01 +0800 Subject: [PATCH 07/17] refactor: rename app title --- src/layout/hero-layout/index.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/layout/hero-layout/index.tsx b/src/layout/hero-layout/index.tsx index e6722ad..f45b8bc 100644 --- a/src/layout/hero-layout/index.tsx +++ b/src/layout/hero-layout/index.tsx @@ -32,7 +32,7 @@ export default function HeroLayout() {
-

三角洲行动改枪码库

+

《三角洲》指南

From 92703d4985f40196ba45bcaf405b3cd7e0f76202 Mon Sep 17 00:00:00 2001 From: zihluwang Date: Mon, 11 May 2026 07:10:30 +0800 Subject: [PATCH 11/17] ci: build and upload release tarball Use pnpm build:tar during release workflow and upload dist.tar.gz. --- .github/workflows/build.yml | 29 ++++++++++++++++++++--------- 1 file changed, 20 insertions(+), 9 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 6d28d28..f0e7c30 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -2,13 +2,13 @@ name: Upload Release Assets on: release: - types: [created] # 仅当创建 Release 之后触发 + types: [created] # Trigger only after a Release is created jobs: build-and-upload: runs-on: ubuntu-latest - # 必须授予权限以允许 Action 修改 Release + # Must grant permission to allow the Action to modify the Release permissions: contents: write @@ -16,15 +16,26 @@ jobs: - name: Checkout code uses: actions/checkout@v4 - - name: Create archive - run: | - TAG_NAME=${{ github.event.release.tag_name }} - tar -czvf "website-dist-${TAG_NAME}.tar.gz" --exclude=".git*" --exclude=".github*" . + - name: Setup Node + uses: actions/setup-node@v4 + with: + node-version: 20 + cache: pnpm + + - name: Setup pnpm + uses: pnpm/action-setup@v4 + with: + version: 11 + + - name: Install dependencies + run: pnpm install --frozen-lockfile + + - name: Build release archive + run: pnpm build:tar - name: Upload Release Asset uses: softprops/action-gh-release@v2 with: - # 上传刚才生成的 tar.gz 文件 - files: dist-${{ github.event.release.tag_name }}.tar.gz + files: dist.tar.gz env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From fd537af9165431efeb226ca37cf0d186ec0da6e1 Mon Sep 17 00:00:00 2001 From: siujamo Date: Mon, 11 May 2026 15:11:08 +0800 Subject: [PATCH 12/17] feat: add CLAUDE.md --- CLAUDE.md | 56 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 CLAUDE.md diff --git a/CLAUDE.md b/CLAUDE.md new file mode 100644 index 0000000..5c3f4fc --- /dev/null +++ b/CLAUDE.md @@ -0,0 +1,56 @@ +# CLAUDE.md + +This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository. + +## Commands + +```bash +pnpm install # Install dependencies (pnpm required) +pnpm dev # Start Vite dev server +pnpm build # TypeScript check + Vite production build +pnpm build:tar # Build + tar.gz archive (used by CI) +pnpm preview # Preview production build locally +pnpm lint # ESLint +``` + +No test suite exists in this project. + +## Architecture + +This is a Chinese-language SPA for browsing and managing Delta Force guide ("《三角洲》指南"). The frontend talks to a Spring Boot backend via REST APIs. + +**App shell** (`src/main.tsx`): React 19 + React Router 7 + Redux Toolkit + Ant Design 6 + Tailwind CSS 4. Wraps the router in Redux `Provider` → `PersistGate` (Redux Persist) → Ant Design `StyleProvider`/`ConfigProvider` (locale `zh_CN`). + +**Routing** (`src/router/index.tsx`): Two layout groups: +- `HeroLayout` (nav header + footer) for `/`, `/firearms`, `/mod-codes` +- `EmptyLayout` (minimal) for `/login` +All page components are lazy-loaded via `createBrowserRouter` + `lazy()`. + +**State** (`src/store/`): Redux Toolkit with two slices — `auth` (current user) and `firearms` (paginated firearm list). State is persisted to `localStorage` or `sessionStorage` based on the `VITE_REDUX_STORAGE` env var. Use typed hooks from `src/store/hooks.ts` (`useAppDispatch`, `useAppSelector`). + +**API layer** (`src/api/`): Axios instance (`src/shared/web-client/`) with base URL from `VITE_API_BASE_URL`, 10s timeout, and credentials. API modules: `FirearmApi`, `ModificationApi`, `TagApi`, `AuthApi`. + +**Pages**: +- `FirearmsPage` — paginated card grid with type filter, create/edit modals (admin-only), delete with popconfirm +- `ModCodesPage` — paginated list with tag multi-select and firearmId query param filter, create/edit modals with nested accessory/tuning form lists +- `LoginPage` — simple username/password form, dispatches `setCurrentUser` on success + +**Shared form components**: `FirearmForm` and `ModificationForm` are reused by both create and edit modals. `ModificationForm` fetches all firearms for its weapon selector and supports a `lockFirearmId` prop that disables the selector (used when navigating from a specific firearm). + +**Type system** (`src/types/`): `Firearm` with weapon stats, `Modification` with nested `Accessory[]` → `Tuning[]`, `Page` for paginated API responses, `User` for auth. + +**Vite config**: Alias `@` → `./src`. Plugins: React, Tailwind CSS 4, port checker. Build uses rolldown with manual chunk splitting for React, Redux, Ant Design, React Router, and rc-* packages. + +**Styling**: Tailwind CSS 4 with CSS layers (`theme, base, antd, components, utilities`). Responsive grid for mod code cards (1→2→3→4 columns). Prettier: 100 print width, no semicolons, double quotes, trailing commas ES5. + +## Environment variables + +``` +VITE_API_BASE_URL=/api # Backend API base URL +VITE_REDUX_STORAGE=local # "local" or "session" for Redux persistence +``` + +## Contributing conventions + +- User-facing copy and documentation in British English +- Commit messages use `chore:` prefix for dependency updates (per Dependabot config) From 7a0a74bfeaa02fb2f67cffaa01413928b58d0bde Mon Sep 17 00:00:00 2001 From: siujamo Date: Mon, 11 May 2026 15:11:31 +0800 Subject: [PATCH 13/17] =?UTF-8?q?refactor:=20rename=20application=20to=20?= =?UTF-8?q?=E3=80=8A=E4=B8=89=E8=A7=92=E6=B4=B2=E3=80=8B=E6=8C=87=E5=8D=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .vscode/launch.json | 39 ++++++++++++++++++--------------------- index.html | 2 +- 2 files changed, 19 insertions(+), 22 deletions(-) diff --git a/.vscode/launch.json b/.vscode/launch.json index d439075..97c312b 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -1,22 +1,19 @@ { - // Use IntelliSense to learn about possible attributes. - // Hover to view descriptions of existing attributes. - // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 - "version": "0.2.0", - "configurations": [ - { - "type": "node-terminal", - "request": "launch", - "name": "pnpm dev", - "command": "pnpm dev", - "cwd": "${workspaceFolder}" - }, - { - "type": "node-terminal", - "request": "launch", - "name": "build", - "command": "pnpm build", - "cwd": "${workspaceFolder}" - } - ] -} \ No newline at end of file + "version": "0.2.0", + "configurations": [ + { + "type": "node-terminal", + "request": "launch", + "name": "pnpm dev", + "command": "pnpm dev", + "cwd": "${workspaceFolder}" + }, + { + "type": "node-terminal", + "request": "launch", + "name": "build", + "command": "pnpm build", + "cwd": "${workspaceFolder}" + } + ] +} diff --git a/index.html b/index.html index 4c8aa19..70e0ed9 100644 --- a/index.html +++ b/index.html @@ -4,7 +4,7 @@ - 三角洲行动改枪码库 + 《三角洲》指南
From 4d009a01959b00c5eaa04f7d8df41608783b44cc Mon Sep 17 00:00:00 2001 From: siujamo Date: Mon, 11 May 2026 17:46:20 +0800 Subject: [PATCH 14/17] fix: migrate login page to Ant Design 6 and Tailwind CSS 4 syntax --- src/page/login/index.tsx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/page/login/index.tsx b/src/page/login/index.tsx index a48c121..7ede3bf 100644 --- a/src/page/login/index.tsx +++ b/src/page/login/index.tsx @@ -29,11 +29,11 @@ export default function LoginPage() { return (
- - + + 登录 - + 使用你的帐号登录后即可继续操作 @@ -54,7 +54,7 @@ export default function LoginPage() { - + From a447bffa779a3c7a3672c3bb6458e6a936bac0fb Mon Sep 17 00:00:00 2001 From: siujamo Date: Mon, 11 May 2026 17:47:28 +0800 Subject: [PATCH 15/17] refactor: update GitHub URLs and English labels in hero layout --- src/layout/hero-layout/index.tsx | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/layout/hero-layout/index.tsx b/src/layout/hero-layout/index.tsx index 314c51b..8c73d7c 100644 --- a/src/layout/hero-layout/index.tsx +++ b/src/layout/hero-layout/index.tsx @@ -100,18 +100,18 @@ export default function HeroLayout() { {isDropdownOpen && ( )} @@ -153,7 +153,7 @@ export default function HeroLayout() { - + 登录 )} From b2fea5df8eac181627b53e45827e347ac7d5bda0 Mon Sep 17 00:00:00 2001 From: siujamo Date: Mon, 11 May 2026 17:48:42 +0800 Subject: [PATCH 16/17] docs: extend British English convention to code comments --- CLAUDE.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CLAUDE.md b/CLAUDE.md index 5c3f4fc..7d92072 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -52,5 +52,5 @@ VITE_REDUX_STORAGE=local # "local" or "session" for Redux persistence ## Contributing conventions -- User-facing copy and documentation in British English +- User-facing copy, documentation, and code comments in British English - Commit messages use `chore:` prefix for dependency updates (per Dependabot config) From 4b9c7d3e0d1631329d84f5050e30b472551ddc5f Mon Sep 17 00:00:00 2001 From: siujamo Date: Tue, 12 May 2026 09:08:37 +0800 Subject: [PATCH 17/17] refactor: move typed Redux hooks from src/store/hooks.ts to src/hooks/store.ts Also update GitHub repository URLs and labels in hero layout. --- CLAUDE.md | 2 +- src/{store/hooks.ts => hooks/store.ts} | 3 +-- src/layout/hero-layout/index.tsx | 2 +- src/page/login/index.tsx | 2 +- 4 files changed, 4 insertions(+), 5 deletions(-) rename src/{store/hooks.ts => hooks/store.ts} (77%) diff --git a/CLAUDE.md b/CLAUDE.md index 7d92072..d5a966d 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -26,7 +26,7 @@ This is a Chinese-language SPA for browsing and managing Delta Force guide ("《 - `EmptyLayout` (minimal) for `/login` All page components are lazy-loaded via `createBrowserRouter` + `lazy()`. -**State** (`src/store/`): Redux Toolkit with two slices — `auth` (current user) and `firearms` (paginated firearm list). State is persisted to `localStorage` or `sessionStorage` based on the `VITE_REDUX_STORAGE` env var. Use typed hooks from `src/store/hooks.ts` (`useAppDispatch`, `useAppSelector`). +**State** (`src/store/`): Redux Toolkit with two slices — `auth` (current user) and `firearms` (paginated firearm list). State is persisted to `localStorage` or `sessionStorage` based on the `VITE_REDUX_STORAGE` env var. Use typed hooks from `src/hooks/store.ts` (`useAppDispatch`, `useAppSelector`). **API layer** (`src/api/`): Axios instance (`src/shared/web-client/`) with base URL from `VITE_API_BASE_URL`, 10s timeout, and credentials. API modules: `FirearmApi`, `ModificationApi`, `TagApi`, `AuthApi`. diff --git a/src/store/hooks.ts b/src/hooks/store.ts similarity index 77% rename from src/store/hooks.ts rename to src/hooks/store.ts index 42426c6..f9a3047 100644 --- a/src/store/hooks.ts +++ b/src/hooks/store.ts @@ -1,6 +1,5 @@ import { useDispatch, useSelector } from "react-redux" -import type { AppDispatch, RootState } from "./index" +import type { AppDispatch, RootState } from "@/store" export const useAppDispatch = useDispatch.withTypes() export const useAppSelector = useSelector.withTypes() - diff --git a/src/layout/hero-layout/index.tsx b/src/layout/hero-layout/index.tsx index 8c73d7c..5d66202 100644 --- a/src/layout/hero-layout/index.tsx +++ b/src/layout/hero-layout/index.tsx @@ -9,7 +9,7 @@ import { LoginOutlined, } from "@ant-design/icons" import { AuthApi } from "@/api" -import { useAppDispatch, useAppSelector } from "@/store/hooks" +import { useAppDispatch, useAppSelector } from "@/hooks/store" import { clearCurrentUser } from "@/store/auth-slice" import { useState } from "react" diff --git a/src/page/login/index.tsx b/src/page/login/index.tsx index 7ede3bf..c077fe5 100644 --- a/src/page/login/index.tsx +++ b/src/page/login/index.tsx @@ -2,7 +2,7 @@ import { useState } from "react" import { useNavigate } from "react-router-dom" import { App, Button, Card, Form, Input, Typography } from "antd" import { AuthApi } from "@/api" -import { useAppDispatch } from "@/store/hooks" +import { useAppDispatch } from "@/hooks/store" import { setCurrentUser } from "@/store/auth-slice" import { LoginRequest } from "@/types"