mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-22 05:35:13 +00:00
chore: use readdir
internally rather than globby
This commit is contained in:
parent
c45131b46f
commit
0ef8febb8c
@ -2,7 +2,6 @@ import { execSync } from 'node:child_process'
|
||||
import { promises as fsp } from 'node:fs'
|
||||
import { $fetch } from 'ofetch'
|
||||
import { resolve } from 'pathe'
|
||||
import { globby } from 'globby'
|
||||
import { execaSync } from 'execa'
|
||||
import { determineSemverChange, getGitDiff, loadChangelogConfig, parseCommits } from 'changelogen'
|
||||
|
||||
@ -43,12 +42,13 @@ export async function loadPackage (dir: string) {
|
||||
|
||||
export async function loadWorkspace (dir: string) {
|
||||
const workspacePkg = await loadPackage(dir)
|
||||
const pkgDirs = (await globby(['packages/*'], { onlyDirectories: true })).sort()
|
||||
const pkgDirs = await fsp.readdir('packages', { withFileTypes: true })
|
||||
|
||||
const packages: Package[] = []
|
||||
|
||||
for (const pkgDir of pkgDirs) {
|
||||
const pkg = await loadPackage(pkgDir)
|
||||
if (!pkgDir.isDirectory()) { continue }
|
||||
const pkg = await loadPackage(resolve('packages', pkgDir.name))
|
||||
if (!pkg.data.name) { continue }
|
||||
packages.push(pkg)
|
||||
}
|
||||
|
@ -1,26 +1,22 @@
|
||||
import { fileURLToPath } from 'node:url'
|
||||
import { rm } from 'node:fs/promises'
|
||||
|
||||
import { globby } from 'globby'
|
||||
import { readdir, rm } from 'node:fs/promises'
|
||||
|
||||
import { execa } from 'execa'
|
||||
import { join } from 'pathe'
|
||||
|
||||
async function initTesting () {
|
||||
const dirs = await globby('*', {
|
||||
onlyDirectories: true,
|
||||
cwd: fileURLToPath(new URL('./fixtures', import.meta.url)),
|
||||
absolute: true,
|
||||
})
|
||||
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(`${dir}/.nuxt`, { force: true, recursive: true })),
|
||||
...dirs.map(dir => rm(join(fixturesDir, `${dir}/.nuxt`), { force: true, recursive: true })),
|
||||
// clear vite cache
|
||||
...dirs.map(dir => rm(`${dir}/node_modules/.cache`, { force: true, recursive: true })),
|
||||
...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: dir })),
|
||||
dirs.map(dir => execa('pnpm', ['nuxi', 'prepare'], { cwd: join(fixturesDir, dir) })),
|
||||
)
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user