From b4b98041f0a8d08fd0bdc409bfbf86043d39dc34 Mon Sep 17 00:00:00 2001 From: Anthony Fu Date: Thu, 21 Jul 2022 18:46:50 +0800 Subject: [PATCH] fix(kit, nuxt): always sort globby results (#6029) --- packages/kit/src/resolve.ts | 2 +- packages/nuxt/src/components/scan.ts | 3 ++- scripts/bump-edge.ts | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/packages/kit/src/resolve.ts b/packages/kit/src/resolve.ts index d94065a615..457425e893 100644 --- a/packages/kit/src/resolve.ts +++ b/packages/kit/src/resolve.ts @@ -148,5 +148,5 @@ async function existsSensitive (path: string) { export async function resolveFiles (path: string, pattern: string | string[]) { const files = await globby(pattern, { cwd: path, followSymbolicLinks: true }) - return files.map(p => resolve(path, p)).filter(p => !isIgnored(p)) + return files.map(p => resolve(path, p)).filter(p => !isIgnored(p)).sort() } diff --git a/packages/nuxt/src/components/scan.ts b/packages/nuxt/src/components/scan.ts index 8af5604d1d..bb24943572 100644 --- a/packages/nuxt/src/components/scan.ts +++ b/packages/nuxt/src/components/scan.ts @@ -27,7 +27,8 @@ export async function scanComponents (dirs: ComponentsDir[], srcDir: string): Pr // A map from resolved path to component name (used for making duplicate warning message) const resolvedNames = new Map() - for (const _file of await globby(dir.pattern!, { cwd: dir.path, ignore: dir.ignore })) { + const files = (await globby(dir.pattern!, { cwd: dir.path, ignore: dir.ignore })).sort() + for (const _file of files) { const filePath = join(dir.path, _file) if (scannedPaths.find(d => filePath.startsWith(d)) || isIgnored(filePath)) { diff --git a/scripts/bump-edge.ts b/scripts/bump-edge.ts index 0b7a11aff9..9096979d7d 100644 --- a/scripts/bump-edge.ts +++ b/scripts/bump-edge.ts @@ -34,7 +34,7 @@ type Package = ThenArg> async function loadWorkspace (dir: string) { const workspacePkg = await loadPackage(dir) - const pkgDirs = await globby(workspacePkg.data.workspaces || [], { onlyDirectories: true }) + const pkgDirs = (await globby(workspacePkg.data.workspaces || [], { onlyDirectories: true })).sort() const packages: Package[] = []