feat: 添加部署脚本和AI推荐脚本
This commit is contained in:
@@ -20,7 +20,8 @@
|
||||
"test:e2e": "jest --config ./test/jest-e2e.json",
|
||||
"crawl": "ts-node -r tsconfig-paths/register src/scripts/crawl.ts",
|
||||
"update-source": "ts-node -r tsconfig-paths/register src/scripts/update-source.ts",
|
||||
"web": "npm --prefix frontend run build"
|
||||
"ai-recommendations": "ts-node -r tsconfig-paths/register src/scripts/ai-recommendations.ts",
|
||||
"deploy": "powershell -ExecutionPolicy Bypass -File src/scripts/deploy.ps1"
|
||||
},
|
||||
"dependencies": {
|
||||
"@nestjs/common": "^11.0.1",
|
||||
|
||||
55
src/scripts/deploy.ps1
Normal file
55
src/scripts/deploy.ps1
Normal file
@@ -0,0 +1,55 @@
|
||||
# Deploy script - Upload files to remote server using scp
|
||||
|
||||
# Configuration
|
||||
$remoteHost = "127.0.0.1"
|
||||
$remotePort = "1122"
|
||||
$remoteUser = "cubie"
|
||||
$keyPath = "d:\163"
|
||||
$serverDest = "/home/cubie/down/document/bidding/publish/server"
|
||||
$frontendDest = "/home/cubie/down/document/bidding/publish/"
|
||||
|
||||
# Check if key file exists
|
||||
if (-not (Test-Path $keyPath)) {
|
||||
Write-Error "Private key file not found: $keyPath"
|
||||
exit 1
|
||||
}
|
||||
|
||||
# Check if dist directory exists
|
||||
if (-not (Test-Path "dist")) {
|
||||
Write-Error "dist directory not found, please run npm run build first"
|
||||
exit 1
|
||||
}
|
||||
|
||||
# Check if frontend directory exists
|
||||
if (-not (Test-Path "frontend")) {
|
||||
Write-Error "frontend directory not found"
|
||||
exit 1
|
||||
}
|
||||
|
||||
Write-Host "Starting deployment..." -ForegroundColor Green
|
||||
Write-Host "Remote server: ${remoteHost}:${remotePort}" -ForegroundColor Cyan
|
||||
Write-Host "Private key: $keyPath" -ForegroundColor Cyan
|
||||
|
||||
# Upload dist directory contents to server directory
|
||||
Write-Host "`nUploading dist directory to ${serverDest}..." -ForegroundColor Yellow
|
||||
scp -i $keyPath -P $remotePort -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -r dist/* "${remoteUser}@${remoteHost}:${serverDest}"
|
||||
|
||||
if ($LASTEXITCODE -ne 0) {
|
||||
Write-Error "Failed to upload dist directory"
|
||||
exit 1
|
||||
}
|
||||
|
||||
Write-Host "dist directory uploaded successfully" -ForegroundColor Green
|
||||
|
||||
# Upload entire frontend directory to publish directory
|
||||
Write-Host "`nUploading frontend directory to ${frontendDest}..." -ForegroundColor Yellow
|
||||
scp -i $keyPath -P $remotePort -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -r frontend "${remoteUser}@${remoteHost}:${frontendDest}"
|
||||
|
||||
if ($LASTEXITCODE -ne 0) {
|
||||
Write-Error "Failed to upload frontend directory"
|
||||
exit 1
|
||||
}
|
||||
|
||||
Write-Host "frontend directory uploaded successfully" -ForegroundColor Green
|
||||
|
||||
Write-Host "`nDeployment completed!" -ForegroundColor Green
|
||||
Reference in New Issue
Block a user