48 lines
1.5 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.

---
name: deploy
description: 将 PolyClientVuetify 项目打包并通过 SSH 部署到远程服务器。用户说「部署」「发布」时使用此 skill。
---
# 项目打包并部署
将 PolyClientVuetify 项目构建后通过 SSH rsync 部署到 `root@38.246.250.238:/opt/1panel/www/sites/pm.xtrader.vip/index`
## 使用方式
在项目根目录执行:
```bash
npm run deploy
```
## 执行流程
1. **打包**:执行 `npm run build`,生成 `dist/` 目录
- 生产构建自动使用 `.env.production`API 地址为 `https://api.xtrader.vip`
2. **SSH 部署**:使用 rsync 将 `dist/` 同步到远程目录
## 前置条件
- 本机已配置 SSH 免密登录 `root@38.246.250.238`,或可交互输入密码
- 远程目录 `/opt/1panel/www/sites/pm.xtrader.vip/index` 需存在且有写权限
## 环境变量(可选)
`.env``.env.local` 中配置,不配置时使用默认值:
| 变量 | 默认值 | 说明 |
|------|--------|------|
| `DEPLOY_HOST` | 38.246.250.238 | 部署目标主机 |
| `DEPLOY_USER` | root | SSH 用户 |
| `DEPLOY_PATH` | /opt/1panel/www/sites/pm.xtrader.vip/index | 远程目录 |
## 涉及文件
- **部署脚本**`scripts/deploy.mjs`
- **构建输出**`dist/`(由 Vite 生成)
## 故障排查
- **Permission denied**:确认 SSH 密钥已添加到远程服务器(`ssh-copy-id root@38.246.250.238`
- **目录不存在**:在远程服务器执行 `mkdir -p /opt/1panel/www/sites/pm.xtrader.vip/index`