Skip to content

Commit dc2b43d

Browse files
authored
refactor: rewrite matechat playground (#77)
1 parent a69399f commit dc2b43d

36 files changed

+2339
-1839
lines changed

.cspell.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
"devui",
77
"gitcode",
88
"jbolda",
9+
"languagedetector",
910
"matechat",
1011
"nanoevents",
1112
"rolldown",

biome.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"$schema": "https://biomejs.dev/schemas/2.1.3/schema.json",
2+
"$schema": "https://biomejs.dev/schemas/2.2.4/schema.json",
33
"vcs": {
44
"enabled": true,
55
"clientKind": "git",
@@ -23,6 +23,11 @@
2323
"quoteStyle": "double"
2424
}
2525
},
26+
"css": {
27+
"linter": {
28+
"enabled": false
29+
}
30+
},
2631
"assist": {
2732
"enabled": true,
2833
"actions": {

package.json

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -52,38 +52,38 @@
5252
"react-syntax-highlighter": "^15.5.13"
5353
},
5454
"dependencies": {
55-
"@tailwindcss/vite": "^4.1.11",
55+
"@tailwindcss/vite": "^4.1.14",
5656
"class-variance-authority": "^0.7.1",
5757
"clsx": "^2.1.1",
5858
"nanoevents": "^9.1.0",
59-
"openai": "^5.11.0",
59+
"openai": "^5.23.2",
6060
"react-markdown": "^10.1.0",
61-
"react-syntax-highlighter": "^15.6.1",
61+
"react-syntax-highlighter": "^15.6.6",
6262
"remark-gfm": "^4.0.1",
6363
"remark-math": "^6.0.0",
6464
"tailwind-merge": "^3.3.1"
6565
},
6666
"devDependencies": {
67-
"@biomejs/biome": "^2.1.3",
68-
"@testing-library/jest-dom": "^6.6.4",
67+
"@biomejs/biome": "^2.2.4",
68+
"@testing-library/jest-dom": "^6.9.0",
6969
"@testing-library/react": "^16.3.0",
70-
"@types/node": "^24.2.0",
71-
"@types/react": "^19.1.9",
72-
"@types/react-dom": "^19.1.7",
70+
"@types/node": "^24.6.1",
71+
"@types/react": "^19.1.17",
72+
"@types/react-dom": "^19.1.11",
7373
"@types/react-syntax-highlighter": "^15.5.13",
74-
"@vitejs/plugin-react-swc": "^3.11.0",
74+
"@vitejs/plugin-react": "^5.0.4",
7575
"archons": "^0.2.13",
76-
"chalk": "^5.5.0",
76+
"chalk": "^5.6.2",
7777
"happy-dom": "^18.0.1",
7878
"lucide-react": "^0.536.0",
7979
"react": "^19.1.1",
8080
"react-dom": "^19.1.1",
8181
"shadcn": "2.9.3-canary.0",
82-
"tailwindcss": "^4.1.11",
83-
"tsdown": "^0.13.3",
84-
"tsx": "^4.20.3",
85-
"typescript": "^5.9.2",
86-
"vite": "npm:rolldown-vite@^7.0.12",
82+
"tailwindcss": "^4.1.14",
83+
"tsdown": "^0.13.5",
84+
"tsx": "^4.20.6",
85+
"typescript": "^5.9.3",
86+
"vite": "npm:rolldown-vite@^7.1.14",
8787
"vite-plugin-dts": "^4.5.4",
8888
"vite-plugin-lib-inject-css": "^2.2.2",
8989
"vitest": "^3.2.4"

playground/.gitignore

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Logs
2+
logs
3+
*.log
4+
npm-debug.log*
5+
yarn-debug.log*
6+
yarn-error.log*
7+
pnpm-debug.log*
8+
lerna-debug.log*
9+
10+
node_modules
11+
dist
12+
dist-ssr
13+
*.local
14+
15+
# Editor directories and files
16+
.vscode/*
17+
!.vscode/extensions.json
18+
.idea
19+
.DS_Store
20+
*.suo
21+
*.ntvs*
22+
*.njsproj
23+
*.sln
24+
*.sw?
25+
26+
# Trae
27+
.marscode

playground/README.md

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
# React + TypeScript + Vite
2+
3+
This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules.
4+
5+
Currently, two official plugins are available:
6+
7+
- [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react) uses [Babel](https://babeljs.io/) for Fast Refresh
8+
- [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react-swc) uses [SWC](https://swc.rs/) for Fast Refresh
9+
10+
## Expanding the ESLint configuration
11+
12+
If you are developing a production application, we recommend updating the configuration to enable type-aware lint rules:
13+
14+
```js
15+
export default tseslint.config([
16+
globalIgnores(['dist']),
17+
{
18+
files: ['**/*.{ts,tsx}'],
19+
extends: [
20+
// Other configs...
21+
22+
// Remove tseslint.configs.recommended and replace with this
23+
...tseslint.configs.recommendedTypeChecked,
24+
// Alternatively, use this for stricter rules
25+
...tseslint.configs.strictTypeChecked,
26+
// Optionally, add this for stylistic rules
27+
...tseslint.configs.stylisticTypeChecked,
28+
29+
// Other configs...
30+
],
31+
languageOptions: {
32+
parserOptions: {
33+
project: ['./tsconfig.node.json', './tsconfig.app.json'],
34+
tsconfigRootDir: import.meta.dirname,
35+
},
36+
// other options...
37+
},
38+
},
39+
])
40+
```
41+
42+
You can also install [eslint-plugin-react-x](https://github.com/Rel1cx/eslint-react/tree/main/packages/plugins/eslint-plugin-react-x) and [eslint-plugin-react-dom](https://github.com/Rel1cx/eslint-react/tree/main/packages/plugins/eslint-plugin-react-dom) for React-specific lint rules:
43+
44+
```js
45+
// eslint.config.js
46+
import reactX from 'eslint-plugin-react-x'
47+
import reactDom from 'eslint-plugin-react-dom'
48+
49+
export default tseslint.config([
50+
globalIgnores(['dist']),
51+
{
52+
files: ['**/*.{ts,tsx}'],
53+
extends: [
54+
// Other configs...
55+
// Enable lint rules for React
56+
reactX.configs['recommended-typescript'],
57+
// Enable lint rules for React DOM
58+
reactDom.configs.recommended,
59+
],
60+
languageOptions: {
61+
parserOptions: {
62+
project: ['./tsconfig.node.json', './tsconfig.app.json'],
63+
tsconfigRootDir: import.meta.dirname,
64+
},
65+
// other options...
66+
},
67+
},
68+
])
69+
```

playground/index.html

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,12 @@
22
<html lang="en">
33
<head>
44
<meta charset="UTF-8" />
5+
<link rel="icon" type="image/svg+xml" href="/logo.svg" />
56
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
67
<title>MateChat React Playground</title>
78
</head>
89
<body>
9-
<div id="app"></div>
10-
<script type="module" src="/src/index.tsx"></script>
10+
<div id="root"></div>
11+
<script type="module" src="/src/main.tsx"></script>
1112
</body>
1213
</html>

playground/package.json

Lines changed: 21 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,24 +5,32 @@
55
"type": "module",
66
"license": "MIT",
77
"author": {
8-
"email": "fu050409@163.com",
9-
"name": "苏向夜"
8+
"email": "xu060805@gmail.com",
9+
"name": "星弦语"
1010
},
1111
"scripts": {
12-
"build": "vite build",
13-
"dev": "vite"
12+
"dev": "vite",
13+
"build": "tsc -b && vite build",
14+
"lint": "biome check",
15+
"preview": "vite preview"
1416
},
1517
"dependencies": {
16-
"clsx": "^2.1.1"
18+
"@tailwindcss/vite": "^4.1.14",
19+
"clsx": "^2.1.1",
20+
"i18next": "^25.5.3",
21+
"i18next-browser-languagedetector": "^8.2.0",
22+
"react-i18next": "^15.7.4",
23+
"tailwindcss": "^4.1.14"
1724
},
1825
"devDependencies": {
19-
"@tailwindcss/vite": "^4.1.11",
20-
"@types/react": "^19.1.8",
21-
"@types/react-dom": "^19.1.6",
22-
"@vitejs/plugin-react-swc": "^3.10.2",
23-
"react": "^19.1.0",
24-
"react-dom": "^19.1.0",
25-
"tailwindcss": "^4.1.11",
26-
"vite": "npm:rolldown-vite@^6.3.21"
26+
"@biomejs/biome": "^2.2.4",
27+
"@types/react": "^19.1.17",
28+
"@types/react-dom": "^19.1.11",
29+
"@vitejs/plugin-react": "^5.0.4",
30+
"@vitejs/plugin-react-swc": "^4.1.0",
31+
"react": "^19.1.1",
32+
"react-dom": "^19.1.1",
33+
"typescript": "~5.8.3",
34+
"vite": "npm:rolldown-vite@^7.1.14"
2735
}
2836
}

playground/public/logo.svg

Lines changed: 44 additions & 0 deletions
Loading

playground/src/Activate.tsx

Lines changed: 0 additions & 41 deletions
This file was deleted.

0 commit comments

Comments
 (0)