Fix local dist build by clearing incremental cache before nest build

Nest deleteOutDir plus stale tsbuildinfo left an empty dist; force clean tsc emit and commit the rebuilt output.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-08-05 21:38:22 +03:30
co-authored by Cursor
parent cbcea58e94
commit df765c9296
2 changed files with 26 additions and 9 deletions
+3 -1
View File
@@ -3,6 +3,8 @@
"collection": "@nestjs/schematics",
"sourceRoot": "src",
"compilerOptions": {
"deleteOutDir": true
"builder": "tsc",
"deleteOutDir": true,
"webpack": false
}
}
+23 -8
View File
@@ -6,11 +6,30 @@ MIRROR="${NPM_REGISTRY:-https://registry.npmmirror.com}"
echo "==> بیلد لوکال بدون Docker"
echo "==> registry: $MIRROR"
echo "==> node: $(node -v)"
npm config set registry "$MIRROR"
npm ci --no-audit --no-fund
npx prisma generate
npm run build
# Prisma postinstall باید اجازه اجرا داشته باشد
npm config set ignore-scripts false || true
if [ ! -d node_modules ]; then
echo "==> npm ci..."
npm ci --no-audit --no-fund
fi
# اگر اسکریپت‌های prisma بلاک شده باشند
npx --yes prisma generate
echo "==> nest/tsc build (با پاک کردن کش)..."
rm -rf dist tsconfig.build.tsbuildinfo
npx nest build
if [ ! -f dist/main.js ]; then
echo "==> nest build خروجی نداد؛ fallback به tsc..."
rm -rf dist tsconfig.build.tsbuildinfo
npx tsc -p tsconfig.build.json
fi
if [ ! -f dist/main.js ]; then
echo "ERROR: dist/main.js ساخته نشد"
@@ -18,8 +37,4 @@ if [ ! -f dist/main.js ]; then
exit 1
fi
echo "==> OK: dist/main.js آماده است"
echo "بعدی:"
echo " git add dist && git commit -m 'Build dist' && git push"
echo "روی سرور:"
echo " git pull && RUN_SEED=true docker compose -f docker-compose.dist.yml up -d --build"
echo "==> OK: dist/main.js ($(wc -c < dist/main.js) bytes)"