mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-14 10:04:05 +00:00
27 lines
712 B
TypeScript
27 lines
712 B
TypeScript
import { fileURLToPath } from 'node:url'
|
|
import { rm } from 'node:fs/promises'
|
|
|
|
import { glob } from 'tinyglobby'
|
|
import { exec } from 'tinyexec'
|
|
|
|
async function initTesting () {
|
|
const dirs = await glob(['*'], {
|
|
onlyDirectories: true,
|
|
cwd: fileURLToPath(new URL('./fixtures', import.meta.url)),
|
|
absolute: true,
|
|
})
|
|
|
|
await Promise.all([
|
|
// clear nuxt build files
|
|
...dirs.map(dir => rm(`${dir}/.nuxt`, { force: true, recursive: true })),
|
|
// clear vite cache
|
|
...dirs.map(dir => rm(`${dir}/node_modules/.cache`, { force: true, recursive: true })),
|
|
])
|
|
|
|
await Promise.all(
|
|
dirs.map(dir => exec('pnpm', ['nuxi', 'prepare'], { nodeOptions: { cwd: dir } })),
|
|
)
|
|
}
|
|
|
|
initTesting()
|