提交 56115257 authored 作者: 王鹏飞's avatar 王鹏飞

chore: upgrade workspace to pnpm 11 and vite 8

上级 1e4cb7ec
...@@ -50,20 +50,17 @@ ...@@ -50,20 +50,17 @@
"devDependencies": { "devDependencies": {
"@types/react": "^18.3.7", "@types/react": "^18.3.7",
"@types/react-dom": "^18.3.0", "@types/react-dom": "^18.3.0",
"@vitejs/plugin-react-swc": "^4.2.3", "@vitejs/plugin-react": "^6.0.3",
"eslint": "^8.57.0", "eslint": "^8.57.0",
"eslint-plugin-react": "^7.35.2", "eslint-plugin-react": "^7.35.2",
"eslint-plugin-react-hooks": "^4.6.2", "eslint-plugin-react-hooks": "^4.6.2",
"less": "^4.2.0", "less": "^4.2.0",
"vite": "^7.3.1", "vite": "^8.1.5",
"vite-plugin-mkcert": "^1.17.10" "vite-plugin-mkcert": "^1.17.10"
}, },
"browserslist": [ "browserslist": [
"> 1%", "> 1%",
"last 2 versions", "last 2 versions",
"not ie <= 10" "not ie <= 10"
], ]
"optionalDependencies": {
"@rollup/rollup-linux-x64-gnu": "^4.21.2"
}
} }
import { configureStore, combineReducers } from '@reduxjs/toolkit'; import { configureStore, combineReducers } from '@reduxjs/toolkit';
import { persistStore, persistReducer } from 'redux-persist'; import { persistStore, persistReducer } from 'redux-persist';
import storage from 'redux-persist/lib/storage'; // defaults to localStorage for web import storage from 'redux-persist/es/storage'; // defaults to localStorage for web
import * as reducers from './modules'; import * as reducers from './modules';
const persistConfig = { const persistConfig = {
......
import assert from 'node:assert/strict'
import test from 'node:test'
import { readFile } from 'node:fs/promises'
test('Redux Persist storage uses the ESM entry required by Vite 8 interop', async () => {
const source = await readFile(new URL('./index.js', import.meta.url), 'utf8')
assert.match(source, /import storage from 'redux-persist\/es\/storage'/)
})
import { fileURLToPath, URL } from 'node:url' import { fileURLToPath, URL } from 'node:url'
import { defineConfig } from 'vite' import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react-swc' import react from '@vitejs/plugin-react'
import mkcert from 'vite-plugin-mkcert' import mkcert from 'vite-plugin-mkcert'
// https://vitejs.dev/config/ // https://vitejs.dev/config/
......
...@@ -6,11 +6,12 @@ ...@@ -6,11 +6,12 @@
**Architecture:** Keep admin and learning as separate Vite applications with separate routers, state, API clients, dependencies, and outputs. The learning app follows the `saas-bi` module structure, uses TanStack React Query for server state, nuqs for recoverable URL state, and Zustand only for transient cross-component client state. **Architecture:** Keep admin and learning as separate Vite applications with separate routers, state, API clients, dependencies, and outputs. The learning app follows the `saas-bi` module structure, uses TanStack React Query for server state, nuqs for recoverable URL state, and Zustand only for transient cross-component client state.
**Tech Stack:** pnpm 10.33.0, React 18.3.1, Vite 7.3.1, TypeScript, React Router 7, TanStack React Query 5, nuqs 2, Zustand 5, Axios, Vitest, Testing Library. **Tech Stack:** pnpm 11.13.1, Node >=22.13, React 18.3.1, Vite ^8.1.5 with @vitejs/plugin-react ^6.0.3, TypeScript, React Router 7, TanStack React Query 5, nuqs 2, Zustand 5, Axios, Vitest ^4.1.10, Testing Library.
## Global Constraints ## Global Constraints
- Work only on branch `next` in `/Users/max/code/book/admin/center-book`. - Work only on branch `next` in `/Users/max/code/book/admin/center-book`.
- Use Node >=22.13; Vite ^8.1.5 requires Node ^20.19 or >=22.12.
- Preserve the repository name `center-book`. - Preserve the repository name `center-book`.
- Do not modify `com-ebook-app-api`, `com-ebook-pc-api`, `book-app`, or `book-app-h5` in Stage 0. - Do not modify `com-ebook-app-api`, `com-ebook-pc-api`, `book-app`, or `book-app-h5` in Stage 0.
- Do not refactor existing admin business pages while moving them. - Do not refactor existing admin business pages while moving them.
...@@ -152,7 +153,7 @@ Create `package.json`: ...@@ -152,7 +153,7 @@ Create `package.json`:
"name": "center-book-workspace", "name": "center-book-workspace",
"private": true, "private": true,
"version": "1.0.0", "version": "1.0.0",
"packageManager": "pnpm@10.33.0", "packageManager": "pnpm@11.13.1",
"scripts": { "scripts": {
"dev:admin": "pnpm --filter @ebook/admin dev", "dev:admin": "pnpm --filter @ebook/admin dev",
"build:admin": "pnpm --filter @ebook/admin build", "build:admin": "pnpm --filter @ebook/admin build",
...@@ -300,7 +301,7 @@ Replace `apps/admin/vite.config.js` with a config retaining the existing plugins ...@@ -300,7 +301,7 @@ Replace `apps/admin/vite.config.js` with a config retaining the existing plugins
```js ```js
import { fileURLToPath, URL } from 'node:url' import { fileURLToPath, URL } from 'node:url'
import { defineConfig, loadEnv } from 'vite' import { defineConfig, loadEnv } from 'vite'
import react from '@vitejs/plugin-react-swc' import react from '@vitejs/plugin-react'
import mkcert from 'vite-plugin-mkcert' import mkcert from 'vite-plugin-mkcert'
export default defineConfig(({ mode }) => { export default defineConfig(({ mode }) => {
...@@ -506,15 +507,15 @@ Create `apps/learning/package.json`: ...@@ -506,15 +507,15 @@ Create `apps/learning/package.json`:
"@types/react-dom": "^18.3.5", "@types/react-dom": "^18.3.5",
"@typescript-eslint/eslint-plugin": "^7.18.0", "@typescript-eslint/eslint-plugin": "^7.18.0",
"@typescript-eslint/parser": "^7.18.0", "@typescript-eslint/parser": "^7.18.0",
"@vitejs/plugin-react-swc": "^4.2.3", "@vitejs/plugin-react": "^6.0.3",
"eslint": "^8.57.0", "eslint": "^8.57.0",
"eslint-plugin-react-hooks": "^5.2.0", "eslint-plugin-react-hooks": "^5.2.0",
"eslint-plugin-react-refresh": "^0.4.19", "eslint-plugin-react-refresh": "^0.4.19",
"jsdom": "^26.1.0", "jsdom": "^26.1.0",
"typescript": "^5.7.3", "typescript": "^5.7.3",
"vite": "^7.3.1", "vite": "^8.1.5",
"vite-plugin-mkcert": "^1.17.10", "vite-plugin-mkcert": "^1.17.10",
"vitest": "^3.2.4" "vitest": "^4.1.10"
} }
} }
``` ```
...@@ -623,7 +624,7 @@ Create `apps/learning/vite.config.ts`: ...@@ -623,7 +624,7 @@ Create `apps/learning/vite.config.ts`:
import { fileURLToPath, URL } from 'node:url' import { fileURLToPath, URL } from 'node:url'
import { loadEnv } from 'vite' import { loadEnv } from 'vite'
import { defineConfig } from 'vitest/config' import { defineConfig } from 'vitest/config'
import react from '@vitejs/plugin-react-swc' import react from '@vitejs/plugin-react'
import mkcert from 'vite-plugin-mkcert' import mkcert from 'vite-plugin-mkcert'
export default defineConfig(({ mode }) => { export default defineConfig(({ mode }) => {
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
"name": "center-book-workspace", "name": "center-book-workspace",
"private": true, "private": true,
"version": "1.0.0", "version": "1.0.0",
"packageManager": "pnpm@10.33.0", "packageManager": "pnpm@11.13.1",
"scripts": { "scripts": {
"dev:admin": "pnpm --filter @ebook/admin dev", "dev:admin": "pnpm --filter @ebook/admin dev",
"build:admin": "pnpm --filter @ebook/admin build", "build:admin": "pnpm --filter @ebook/admin build",
......
差异被折叠。
...@@ -3,6 +3,5 @@ packages: ...@@ -3,6 +3,5 @@ packages:
- packages/* - packages/*
allowBuilds: allowBuilds:
'@swc/core': true
es5-ext: true es5-ext: true
esbuild: true esbuild: true
Markdown 格式
0% 或
您添加了 0 人 到此讨论。请谨慎行事。
请先完成此评论的编辑!
请 注册 或者 后发表评论