Closed
Description
dir-glob is using path.join()
so it will use \\
as join separator in Windows. It would not compatible with micromatch that reserves backslashes for escaping glob characters.
https://github.com/micromatch/micromatch/#backslashes
It means that the generated glob pattern may not work correctly in Windows environment.
const dirGlob = require('dir-glob')
const micromatch = require('micromatch')
const patterns = dirGlob.sync(['lib'])
console.log(patterns)
console.log(micromatch(['lib/index.js'], patterns))
# POSIX environment
$ node ./test.js
[ 'lib/**' ]
[ 'lib/index.js' ]
# Windows
$ node ./test.js
[ 'lib\\**' ]
[]
I think we should always use slashes to join path by using path.posix.join()
, or provide a option to choose how to join.
It came from working in the upgrade of fast-glob in globby's PR: sindresorhus/globby#126 (review)
Metadata
Metadata
Assignees
Labels
No labels