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:
+3
-1
@@ -3,6 +3,8 @@
|
||||
"collection": "@nestjs/schematics",
|
||||
"sourceRoot": "src",
|
||||
"compilerOptions": {
|
||||
"deleteOutDir": true
|
||||
"builder": "tsc",
|
||||
"deleteOutDir": true,
|
||||
"webpack": false
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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)"
|
||||
|
||||
Reference in New Issue
Block a user