Skip to content

Commit

Permalink
fix: oom #329
Browse files Browse the repository at this point in the history
  • Loading branch information
changfeng committed May 23, 2023
1 parent 0861d01 commit c9948a5
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions packages/utils/src/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,17 +74,18 @@ export const tryGlob = (
const { absolute = true, baseDir = CWD } =
typeof options === 'string' ? { baseDir: options } : options
return paths.reduce<string[]>(
(acc, pkg) =>
[
(acc, pkg) => {
const pkgJsonPath = `${pkg}/package.json`;
return [
...acc,
...(isGlob(pkg)
? tryRequirePkg<typeof import('fast-glob')>('fast-glob')!.sync(pkg, {
? tryRequirePkg<typeof import('fast-glob')>('fast-glob')!.sync(pkgJsonPath, {
absolute,
cwd: baseDir,
onlyFiles: false,
})
: [tryFile(path.resolve(baseDir, pkg), true)]),
].filter(Boolean),
: [tryFile(path.resolve(baseDir, pkgJsonPath), true)]),
].filter(Boolean)
},
[],
)
}
Expand Down

0 comments on commit c9948a5

Please sign in to comment.