chore: improve prepare script

This commit is contained in:
Anthony Fu 2023-09-01 16:53:35 +02:00
parent e053eefad5
commit 05f8a29060

View File

@ -1,5 +1,6 @@
import { fileURLToPath } from 'node:url'
import fg from 'fast-glob'
import fs from 'fs-extra'
import { execa } from 'execa'
const dirs = await fg('*', {
@ -8,6 +9,13 @@ const dirs = await fg('*', {
absolute: true
})
await Promise.all([
// clear nuxt build files
...dirs.map(dir => fs.remove(`${dir}/.nuxt`)),
// clear vite cache
...dirs.map(dir => fs.remove(`${dir}/node_modules/.vite`), { force: true })
])
await Promise.all(
dirs.map(dir => execa('pnpm', ['nuxi', 'prepare'], { cwd: dir }))
)