feat: enhance blog components, improve routing, and add clean script for build process

This commit is contained in:
mahdiarghyani
2025-12-14 13:37:51 +03:30
parent 25aa41bcb8
commit c6b09fabc9
11 changed files with 117 additions and 37 deletions
+32
View File
@@ -0,0 +1,32 @@
import fs from 'node:fs'
const pathsToRemove = ['.nuxt', '.output']
const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms))
async function rmWithRetry(path, retries = 10) {
for (let attempt = 0; attempt <= retries; attempt++) {
try {
fs.rmSync(path, { recursive: true, force: true })
return
} catch (error) {
const code = error?.code
const shouldRetry = code === 'EBUSY' || code === 'EPERM'
if (!shouldRetry || attempt === retries) {
console.error(
`[clean] Failed to remove "${path}".\n` +
`Close any running "nuxt preview" / dev servers using it, then rerun.\n` +
`Error: ${code || error}`
)
process.exit(1)
}
await sleep(250)
}
}
}
for (const path of pathsToRemove) {
await rmWithRetry(path)
}