fix: Prisma binary download for Iran servers
This commit is contained in:
28
scripts/copy-prisma-generated.ps1
Normal file
28
scripts/copy-prisma-generated.ps1
Normal file
@@ -0,0 +1,28 @@
|
||||
# اسکریپت کپی کردن Prisma generated files برای deployment
|
||||
|
||||
Write-Host "Copying Prisma generated files..." -ForegroundColor Cyan
|
||||
|
||||
# ساخت پوشه
|
||||
New-Item -ItemType Directory -Force -Path "prisma/generated" | Out-Null
|
||||
|
||||
# بررسی وجود فایلها
|
||||
if (-not (Test-Path "node_modules/.prisma/client")) {
|
||||
Write-Host "Error: Prisma client not found!" -ForegroundColor Red
|
||||
Write-Host "Please run: npm install && npx prisma generate" -ForegroundColor Yellow
|
||||
exit 1
|
||||
}
|
||||
|
||||
# کپی کردن
|
||||
Write-Host "Copying .prisma/client..." -ForegroundColor Green
|
||||
Copy-Item -Recurse -Force "node_modules/.prisma/client" "prisma/generated/.prisma-client"
|
||||
|
||||
Write-Host "Copying @prisma/client..." -ForegroundColor Green
|
||||
Copy-Item -Recurse -Force "node_modules/@prisma/client" "prisma/generated/@prisma-client"
|
||||
|
||||
Write-Host ""
|
||||
Write-Host "✓ Files copied successfully!" -ForegroundColor Green
|
||||
Write-Host ""
|
||||
Write-Host "Now commit and push:" -ForegroundColor Cyan
|
||||
Write-Host "git add prisma/generated"
|
||||
Write-Host "git commit -m 'Add pre-generated Prisma client'"
|
||||
Write-Host "git push"
|
||||
28
scripts/copy-prisma-generated.sh
Normal file
28
scripts/copy-prisma-generated.sh
Normal file
@@ -0,0 +1,28 @@
|
||||
#!/bin/bash
|
||||
|
||||
echo "Copying Prisma generated files..."
|
||||
|
||||
# ساخت پوشه
|
||||
mkdir -p prisma/generated
|
||||
|
||||
# بررسی وجود فایلها
|
||||
if [ ! -d "node_modules/.prisma/client" ]; then
|
||||
echo "Error: Prisma client not found!"
|
||||
echo "Please run: npm install && npx prisma generate"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# کپی کردن
|
||||
echo "Copying .prisma/client..."
|
||||
cp -r node_modules/.prisma/client prisma/generated/.prisma-client
|
||||
|
||||
echo "Copying @prisma/client..."
|
||||
cp -r node_modules/@prisma/client prisma/generated/@prisma-client
|
||||
|
||||
echo ""
|
||||
echo "✓ Files copied successfully!"
|
||||
echo ""
|
||||
echo "Now commit and push:"
|
||||
echo "git add prisma/generated"
|
||||
echo "git commit -m 'Add pre-generated Prisma client'"
|
||||
echo "git push"
|
||||
60
scripts/test-connectivity.ps1
Normal file
60
scripts/test-connectivity.ps1
Normal file
@@ -0,0 +1,60 @@
|
||||
# Test connectivity to required sites for Docker build
|
||||
|
||||
Write-Host "==========================================" -ForegroundColor Cyan
|
||||
Write-Host "Testing connectivity to required sites..." -ForegroundColor Cyan
|
||||
Write-Host "==========================================" -ForegroundColor Cyan
|
||||
Write-Host ""
|
||||
|
||||
function Test-Site {
|
||||
param($site)
|
||||
|
||||
Write-Host "Testing $site ... " -NoNewline
|
||||
|
||||
try {
|
||||
$response = Invoke-WebRequest -Uri "https://$site" -Method Head -TimeoutSec 5 -ErrorAction Stop
|
||||
Write-Host "✓ OK" -ForegroundColor Green
|
||||
return $true
|
||||
} catch {
|
||||
Write-Host "✗ FAILED" -ForegroundColor Red
|
||||
return $false
|
||||
}
|
||||
}
|
||||
|
||||
# Test NPM
|
||||
Write-Host "=== NPM Registry ===" -ForegroundColor Yellow
|
||||
Test-Site "registry.npmjs.org"
|
||||
Write-Host ""
|
||||
|
||||
# Test Prisma
|
||||
Write-Host "=== Prisma Binaries ===" -ForegroundColor Yellow
|
||||
Test-Site "binaries.prisma.sh"
|
||||
Test-Site "binaries.prismacdn.com"
|
||||
Write-Host ""
|
||||
|
||||
# Test Docker
|
||||
Write-Host "=== Docker Registry ===" -ForegroundColor Yellow
|
||||
Test-Site "registry.hub.docker.com"
|
||||
Test-Site "registry-1.docker.io"
|
||||
Write-Host ""
|
||||
|
||||
# Test DNS
|
||||
Write-Host "=== DNS Resolution ===" -ForegroundColor Yellow
|
||||
Write-Host "Checking DNS for registry.npmjs.org ... " -NoNewline
|
||||
try {
|
||||
$dns = Resolve-DnsName registry.npmjs.org -ErrorAction Stop
|
||||
Write-Host "✓ OK" -ForegroundColor Green
|
||||
} catch {
|
||||
Write-Host "✗ FAILED" -ForegroundColor Red
|
||||
}
|
||||
|
||||
Write-Host ""
|
||||
Write-Host "==========================================" -ForegroundColor Cyan
|
||||
Write-Host "Summary:" -ForegroundColor Cyan
|
||||
Write-Host "==========================================" -ForegroundColor Cyan
|
||||
Write-Host ""
|
||||
Write-Host "If any tests failed, you need to:" -ForegroundColor Yellow
|
||||
Write-Host "1. Use Shecan/Electro DNS"
|
||||
Write-Host "2. Use VPN/Proxy"
|
||||
Write-Host "3. Build on external server"
|
||||
Write-Host ""
|
||||
Write-Host "See REQUIRED_SITES.md for details" -ForegroundColor Cyan
|
||||
63
scripts/test-connectivity.sh
Normal file
63
scripts/test-connectivity.sh
Normal file
@@ -0,0 +1,63 @@
|
||||
#!/bin/bash
|
||||
|
||||
echo "=========================================="
|
||||
echo "Testing connectivity to required sites..."
|
||||
echo "=========================================="
|
||||
echo ""
|
||||
|
||||
# Colors
|
||||
RED='\033[0;31m'
|
||||
GREEN='\033[0;32m'
|
||||
YELLOW='\033[1;33m'
|
||||
NC='\033[0m' # No Color
|
||||
|
||||
test_site() {
|
||||
local site=$1
|
||||
echo -n "Testing $site ... "
|
||||
|
||||
if curl -s --connect-timeout 5 -I "https://$site" > /dev/null 2>&1; then
|
||||
echo -e "${GREEN}✓ OK${NC}"
|
||||
return 0
|
||||
else
|
||||
echo -e "${RED}✗ FAILED${NC}"
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
# Test NPM
|
||||
echo "=== NPM Registry ==="
|
||||
test_site "registry.npmjs.org"
|
||||
echo ""
|
||||
|
||||
# Test Prisma
|
||||
echo "=== Prisma Binaries ==="
|
||||
test_site "binaries.prisma.sh"
|
||||
test_site "binaries.prismacdn.com"
|
||||
echo ""
|
||||
|
||||
# Test Docker
|
||||
echo "=== Docker Registry ==="
|
||||
test_site "registry.hub.docker.com"
|
||||
test_site "registry-1.docker.io"
|
||||
echo ""
|
||||
|
||||
# Test DNS
|
||||
echo "=== DNS Resolution ==="
|
||||
echo -n "Checking DNS for registry.npmjs.org ... "
|
||||
if nslookup registry.npmjs.org > /dev/null 2>&1; then
|
||||
echo -e "${GREEN}✓ OK${NC}"
|
||||
else
|
||||
echo -e "${RED}✗ FAILED${NC}"
|
||||
fi
|
||||
|
||||
echo ""
|
||||
echo "=========================================="
|
||||
echo "Summary:"
|
||||
echo "=========================================="
|
||||
echo ""
|
||||
echo "If any tests failed, you need to:"
|
||||
echo "1. Use Shecan/Electro DNS"
|
||||
echo "2. Use VPN/Proxy"
|
||||
echo "3. Build on external server"
|
||||
echo ""
|
||||
echo "See REQUIRED_SITES.md for details"
|
||||
Reference in New Issue
Block a user