Files
fabric_trade_server/scripts/pack-prisma-client.sh
T
mohmdsdgandCursor d5dfd6a0f0 Ship prebuilt Prisma client so the server never runs prisma generate
prisma generate needs over three minutes on the production host, which made
every deploy hang on that build step. The client is now generated on the dev
machine into prisma-client.tar.gz (tracked, 8.5MB) and the image just untars
it. Dropping the unused linux-musl engine target halves that payload.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-08 16:35:06 +03:30

27 lines
977 B
Bash

#!/usr/bin/env bash
# کلاینت Prisma را روی سیستم دولوپر می‌سازد و بسته‌بندی می‌کند.
# سرور نباید prisma generate بزند؛ روی هاست پروडاکشن دقایق طول می‌کشد.
set -euo pipefail
cd "$(dirname "$0")/.."
OUT="prisma-client.tar.gz"
SRC="node_modules/.prisma/client"
if [ ! -d node_modules/prisma ]; then
echo "ERROR: node_modules نیست. اول npm ci بزن." >&2
exit 1
fi
# خروجی قبلی پاک شود تا engineهای بی‌استفاده در بسته نمانند
rm -rf "$SRC"
DATABASE_URL="${DATABASE_URL:-postgresql://build:build@localhost:5432/build?schema=public}" \
CHECKPOINT_DISABLE=1 ./node_modules/.bin/prisma generate
test -f "$SRC/libquery_engine-debian-openssl-3.0.x.so.node" \
|| { echo "ERROR: engine مربوط به debian-openssl-3.0.x ساخته نشد." >&2; exit 1; }
rm -f "$OUT"
tar -czf "$OUT" -C node_modules/.prisma client
ls -lh "$OUT"