feat: 完成情绪博物馆项目重构和功能增强 - 新增日记评论和帖子功能 - 重构前端架构,优化用户体验 - 完善WebSocket通信机制 - 更新项目文档和部署配置
This commit is contained in:
@@ -0,0 +1,52 @@
|
||||
# 部署脚本 - 将构建好的文件上传到服务器
|
||||
# 使用方法: .\deploy.ps1
|
||||
|
||||
param(
|
||||
[string]$ServerIP = "47.111.10.27",
|
||||
[string]$Username = "root",
|
||||
[string]$RemotePath = "/data/www/emotion-museum"
|
||||
)
|
||||
|
||||
Write-Host "开始部署前端应用到服务器..." -ForegroundColor Green
|
||||
|
||||
# 检查dist目录是否存在
|
||||
if (-not (Test-Path "dist")) {
|
||||
Write-Host "错误: dist目录不存在,请先运行 npm run build" -ForegroundColor Red
|
||||
exit 1
|
||||
}
|
||||
|
||||
# 检查是否安装了scp命令(需要安装OpenSSH客户端)
|
||||
try {
|
||||
scp 2>&1 | Out-Null
|
||||
} catch {
|
||||
Write-Host "错误: 未找到scp命令,请安装OpenSSH客户端" -ForegroundColor Red
|
||||
Write-Host "可以通过以下方式安装:" -ForegroundColor Yellow
|
||||
Write-Host "1. Windows 10/11: 设置 -> 应用 -> 可选功能 -> 添加功能 -> OpenSSH客户端" -ForegroundColor Yellow
|
||||
Write-Host "2. 或者使用 WinSCP 等工具手动上传" -ForegroundColor Yellow
|
||||
exit 1
|
||||
}
|
||||
|
||||
Write-Host "正在上传文件到服务器 $ServerIP..." -ForegroundColor Yellow
|
||||
|
||||
# 上传所有文件到服务器
|
||||
try {
|
||||
# 上传index.html
|
||||
scp "dist/index.html" "${Username}@${ServerIP}:${RemotePath}/"
|
||||
|
||||
# 上传assets目录
|
||||
scp -r "dist/assets" "${Username}@${ServerIP}:${RemotePath}/"
|
||||
|
||||
# 上传测试文件
|
||||
scp "dist/test-*.html" "${Username}@${ServerIP}:${RemotePath}/"
|
||||
|
||||
Write-Host "部署完成!" -ForegroundColor Green
|
||||
Write-Host "访问地址: http://$ServerIP/emotion-museum/" -ForegroundColor Cyan
|
||||
|
||||
} catch {
|
||||
Write-Host "部署失败: $($_.Exception.Message)" -ForegroundColor Red
|
||||
Write-Host "请检查:" -ForegroundColor Yellow
|
||||
Write-Host "1. 服务器IP地址是否正确" -ForegroundColor Yellow
|
||||
Write-Host "2. SSH密钥是否配置正确" -ForegroundColor Yellow
|
||||
Write-Host "3. 服务器目录权限是否正确" -ForegroundColor Yellow
|
||||
exit 1
|
||||
}
|
||||
Reference in New Issue
Block a user