完善README

This commit is contained in:
LeonspaceX
2025-10-18 21:22:31 +08:00
parent cb0fd04f59
commit 9291d0ae20
2 changed files with 92 additions and 129 deletions

151
README.md
View File

@@ -1,74 +1,107 @@
# React + TypeScript + Vite
A simple anonymous post website awa!
This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules.
Currently, two official plugins are available:
- [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react) uses [Babel](https://babeljs.io/) (or [oxc](https://oxc.rs) when used in [rolldown-vite](https://vite.dev/guide/rolldown)) for Fast Refresh
- [@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
## 快速开始~
## React Compiler
The React Compiler is not enabled on this template because of its impact on dev & build performances. To add it, see [this documentation](https://react.dev/learn/react-compiler/installation).
## Expanding the ESLint configuration
0、Clone本仓库
If you are developing a production application, we recommend updating the configuration to enable type-aware lint rules:
```js
export default defineConfig([
globalIgnores(['dist']),
{
files: ['**/*.{ts,tsx}'],
extends: [
// Other configs...
// Remove tseslint.configs.recommended and replace with this
tseslint.configs.recommendedTypeChecked,
// Alternatively, use this for stricter rules
tseslint.configs.strictTypeChecked,
// Optionally, add this for stylistic rules
tseslint.configs.stylisticTypeChecked,
`git clone https://github.com/Sycamore-Whisper/frontend.git`
// Other configs...
],
languageOptions: {
parserOptions: {
project: ['./tsconfig.node.json', './tsconfig.app.json'],
tsconfigRootDir: import.meta.dirname,
},
// other options...
},
},
])
1、安装node依赖
`pnpm install`
2、修改配置
找到/src/config.ts根据注释配置后端信息和变量
接下来,找到/public/icon.png将其替换为你自己的图标
最后,找到/public/about.md填入自己的关于信息
配置完成!
3、构建静态文件
`pnpm build`
生成出的静态文件在/dist目录下将其上传到静态网页托管服务商或者自己的服务器上
接下来配置SPA路由回退
```nginx
# Nginx/OpenResty
location / {
try_files $uri $uri/ /index.html;
}
```
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:
```js
// eslint.config.js
import reactX from 'eslint-plugin-react-x'
import reactDom from 'eslint-plugin-react-dom'
export default defineConfig([
globalIgnores(['dist']),
{
files: ['**/*.{ts,tsx}'],
extends: [
// Other configs...
// Enable lint rules for React
reactX.configs['recommended-typescript'],
// Enable lint rules for React DOM
reactDom.configs.recommended,
],
languageOptions: {
parserOptions: {
project: ['./tsconfig.node.json', './tsconfig.app.json'],
tsconfigRootDir: import.meta.dirname,
},
// other options...
},
},
])
```nginx
# Apache - .htaccess
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule . /index.html [L]
</IfModule>
```
"# frontend"
4、初始化后端
打开前端,会自动跳转至/init以便配置后端参数
部署完成owo。
`python api\_server.py`
后端API已部署完成喵接下来请调用/init接口进行初始化
## License
This project is licensed under the MIT License.