源码打包命令整理(PowerShell 版)

一、Tauri 项目(JjFms)
powershell
tar --exclude=node_modules --exclude=src-tauri/target --exclude=dist --exclude=.git -czvf ../JjFms-backup.tar.gz .
| 排除项 | 原因 |
|---|---|
node_modules |
依赖,pnpm install 重装 |
src-tauri/target |
Rust 编译产物,几 GB,必须排除 |
dist |
前端构建产物,pnpm build 重建 |
.git |
版本历史 |
恢复:
powershell
tar -xzvf JjFms-backup.tar.gz -C ./JjFms-restore
cd JjFms-restore
pnpm install
pnpm tauri dev
注意 :Tauri 恢复后需要 Rust 环境,客户跑不了。客户要能用,直接给 src-tauri/target/release/ 下的 .exe。
二、Vben-admin 项目
powershell
tar --exclude=node_modules --exclude=apps/*/dist --exclude=.turbo --exclude=.git --exclude=.husky -czvf ../vben-backup.tar.gz .
| 排除项 | 原因 |
|---|---|
node_modules |
依赖,pnpm install 重装 |
apps/*/dist |
各子应用构建产物(Monorepo,dist 不在根目录) |
.turbo |
Turborepo 缓存 |
.git |
版本历史 |
.husky |
Git hooks |
恢复:
powershell
tar -xzvf vben-backup.tar.gz -C ./vben-restore
cd vben-restore
pnpm install
pnpm run dev
注意 :确认 apps/*/.env 文件在包里,不在就补上。
三、通用规则
| 项目 | 必须排除 | 原因 |
|---|---|---|
| 所有前端项目 | node_modules |
依赖可重装 |
| 所有前端项目 | dist |
构建产物可重建 |
| Tauri | src-tauri/target |
Rust 编译缓存,几 GB |
| Vben Monorepo | apps/*/dist |
dist 在子目录 |
| Vben Monorepo | .turbo |
Turborepo 缓存 |
| 可选 | .git |
不要历史就排除 |
| 可选 | .husky |
Git hooks |