web/README.md
2025-04-25 11:26:38 +08:00

102 lines
1.9 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# icrypto.work
这是一个加密货币AI服务平台基于Vue 3和Vite开发。
## 推荐的IDE设置
[VSCode](https://code.visualstudio.com/) + [Volar](https://marketplace.visualstudio.com/items?itemName=Vue.volar) (并禁用Vetur)。
## `.vue`导入的TypeScript支持
TypeScript默认无法处理`.vue`导入的类型信息,因此我们用`vue-tsc`替换`tsc` CLI进行类型检查。在编辑器中我们需要[Volar](https://marketplace.visualstudio.com/items?itemName=Vue.volar)使TypeScript语言服务识别`.vue`类型。
## 自定义配置
参见[Vite配置参考](https://vite.dev/config/)。
## 项目设置
```sh
npm install
```
### 开发环境编译和热重载
```sh
npm run dev
```
### 类型检查、编译和生产环境构建
```sh
npm run build
```
### 使用[Vitest](https://vitest.dev/)运行单元测试
```sh
npm run test:unit
```
### 使用[Playwright](https://playwright.dev)运行端到端测试
```sh
# 首次运行安装浏览器
npx playwright install
# 在CI上测试时必须先构建项目
npm run build
# 运行端到端测试
npm run test:e2e
# 仅在Chromium上运行测试
npm run test:e2e -- --project=chromium
# 运行特定文件的测试
npm run test:e2e -- tests/example.spec.ts
# 在调试模式下运行测试
npm run test:e2e -- --debug
```
### 使用[ESLint](https://eslint.org/)进行代码检查
```sh
npm run lint
```
## Docker部署
本项目支持Docker部署包含以下文件:
- `Dockerfile` - 多阶段构建配置
- `.dockerignore` - 排除不需要的文件
- `docker-compose.yml` - 简化部署配置
- `nginx.conf` - Nginx优化配置
### 使用Docker构建和运行
构建Docker镜像:
```sh
docker build -t icrypto-web .
```
运行容器:
```sh
docker run -p 80:80 icrypto-web
```
### 使用Docker Compose部署
一键构建和部署:
```sh
docker-compose up -d
```
停止服务:
```sh
docker-compose down
```