mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-25 15:15:19 +00:00
24 lines
722 B
TypeScript
24 lines
722 B
TypeScript
import { fileURLToPath } from 'node:url'
|
|
import { readdir, rm } from 'node:fs/promises'
|
|
|
|
import { execa } from 'execa'
|
|
import { join } from 'pathe'
|
|
|
|
async function initTesting () {
|
|
const fixturesDir = fileURLToPath(new URL('./fixtures', import.meta.url))
|
|
const dirs = await readdir(fixturesDir)
|
|
|
|
await Promise.all([
|
|
// clear nuxt build files
|
|
...dirs.map(dir => rm(join(fixturesDir, `${dir}/.nuxt`), { force: true, recursive: true })),
|
|
// clear vite cache
|
|
...dirs.map(dir => rm(join(fixturesDir, `${dir}/node_modules/.cache`), { force: true, recursive: true })),
|
|
])
|
|
|
|
await Promise.all(
|
|
dirs.map(dir => execa('pnpm', ['nuxi', 'prepare'], { cwd: join(fixturesDir, dir) })),
|
|
)
|
|
}
|
|
|
|
initTesting()
|