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",
|
"collection": "@nestjs/schematics",
|
||||||
"sourceRoot": "src",
|
"sourceRoot": "src",
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"deleteOutDir": true
|
"builder": "tsc",
|
||||||
|
"deleteOutDir": true,
|
||||||
|
"webpack": false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,11 +6,30 @@ MIRROR="${NPM_REGISTRY:-https://registry.npmmirror.com}"
|
|||||||
|
|
||||||
echo "==> بیلد لوکال بدون Docker"
|
echo "==> بیلد لوکال بدون Docker"
|
||||||
echo "==> registry: $MIRROR"
|
echo "==> registry: $MIRROR"
|
||||||
|
echo "==> node: $(node -v)"
|
||||||
|
|
||||||
npm config set registry "$MIRROR"
|
npm config set registry "$MIRROR"
|
||||||
npm ci --no-audit --no-fund
|
|
||||||
npx prisma generate
|
# Prisma postinstall باید اجازه اجرا داشته باشد
|
||||||
npm run build
|
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
|
if [ ! -f dist/main.js ]; then
|
||||||
echo "ERROR: dist/main.js ساخته نشد"
|
echo "ERROR: dist/main.js ساخته نشد"
|
||||||
@@ -18,8 +37,4 @@ if [ ! -f dist/main.js ]; then
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "==> OK: dist/main.js آماده است"
|
echo "==> OK: dist/main.js ($(wc -c < dist/main.js) bytes)"
|
||||||
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"
|
|
||||||
|
|||||||
Reference in New Issue
Block a user