Skip to content

Commit e9f7674

Browse files
committed
patches
1 parent 719c921 commit e9f7674

File tree

1 file changed

+16
-15
lines changed

1 file changed

+16
-15
lines changed

lib/utils/path-resolve.js

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -19,17 +19,14 @@ import { isErrnoException } from './type-helpers.js'
1919
*/
2020
const ignoreByDefault = directories()
2121

22-
/** @type { string[]} */
23-
const GLOB_IGNORE = [
24-
...ignoreByDefault.map(item => '**/' + item)
25-
]
26-
2722
/** @type {import('globby').Options} */
2823
const BASE_GLOBBY_OPTS = {
2924
absolute: true,
3025
expandDirectories: false,
3126
gitignore: true,
32-
ignore: GLOB_IGNORE,
27+
ignore: [
28+
...ignoreByDefault.map(item => '**/' + item)
29+
],
3330
markDirectories: true,
3431
unique: true,
3532
}
@@ -120,15 +117,19 @@ export async function mapGlobEntryToFiles (entry, supportedFiles) {
120117
...BASE_GLOBBY_OPTS,
121118
cwd: entry
122119
})
123-
} else if (path.basename(entry) === 'package.json') {
124-
// If the match is a package.json file, then include it
125-
pkgJSFile = entry
126-
} else if (micromatch.isMatch(entry, jsLockFilePatterns)) {
127-
jsLockFiles = [entry]
128-
pkgJSFile = path.resolve(path.dirname(entry), 'package.json')
129-
if (!(await fileExists(pkgJSFile))) return []
130-
} else if (micromatch.isMatch(entry, pyFilePatterns)) {
131-
pyFiles = [entry]
120+
} else {
121+
const entryFile = path.basename(entry)
122+
123+
if (entryFile === 'package.json') {
124+
// If the match is a package.json file, then include it
125+
pkgJSFile = entry
126+
} else if (micromatch.isMatch(entryFile, jsLockFilePatterns)) {
127+
jsLockFiles = [entry]
128+
pkgJSFile = path.resolve(path.dirname(entry), 'package.json')
129+
if (!(await fileExists(pkgJSFile))) return []
130+
} else if (micromatch.isMatch(entryFile, pyFilePatterns)) {
131+
pyFiles = [entry]
132+
}
132133
}
133134

134135
// If we will include a package.json file but don't already have a corresponding lockfile, then look for one

0 commit comments

Comments
 (0)