shadowzzh / first-view-transition
借助 View Transition API,可以为界面带来柔和自然的主题色转换,从而显著提升整体视觉体验。
React + TypeScript + Vite
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 uses Babel for Fast Refresh
- @vitejs/plugin-react-swc uses SWC for Fast Refresh
Docker 部署
本项目支持使用 Docker 进行构建和部署。以下是使用 Docker 部署的步骤:
构建 Docker 镜像
docker build -t first-view-transition .
运行 Docker 容器
docker run -p 8080:80 first-view-transition
这将启动应用并在 http://localhost:8080 上可访问。
使用 Docker Compose 部署
我们也提供了 Docker Compose 配置,可以更方便地部署应用:
# 构建并启动容器
docker-compose up -d
# 查看容器日志
docker-compose logs -f
# 停止并移除容器
docker-compose down
使用 Docker Compose 部署的优势:
- 更简单的命令行操作
- 更易于管理的配置
- 支持健康检查
- 配置了日志卷挂载,方便查看日志
- 自动重启配置确保应用高可用性
Docker 部署说明
- Dockerfile 使用多阶段构建,第一阶段使用 Node 环境构建应用,第二阶段使用 Nginx 部署静态文件
- nginx.conf 文件包含针对单页应用的优化配置
- 静态资源设置了缓存策略,提高访问速度
- 启用了 gzip 压缩,减少网络传输量
Expanding the ESLint configuration
If you are developing a production application, we recommend updating the configuration to enable type aware lint rules:
- Configure the top-level
parserOptionsproperty like this:
export default tseslint.config({
languageOptions: {
// other options...
parserOptions: {
project: ['./tsconfig.node.json', './tsconfig.app.json'],
tsconfigRootDir: import.meta.dirname
}
}
});
- Replace
tseslint.configs.recommendedtotseslint.configs.recommendedTypeCheckedortseslint.configs.strictTypeChecked - Optionally add
...tseslint.configs.stylisticTypeChecked - Install eslint-plugin-react and update the config:
// eslint.config.js
import react from 'eslint-plugin-react';
export default tseslint.config({
// Set the react version
settings: { react: { version: '18.3' } },
plugins: {
// Add the react plugin
react
},
rules: {
// other rules...
// Enable its recommended rules
...react.configs.recommended.rules,
...react.configs['jsx-runtime'].rules
}
});