Skip to content
This repository has been archived by the owner on May 22, 2024. It is now read-only.

Commit

Permalink
chore: try normalize
Browse files Browse the repository at this point in the history
  • Loading branch information
danez committed Jun 3, 2022
1 parent 2040db9 commit 4776e68
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 5 deletions.
14 changes: 14 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@
"locate-path": "^6.0.0",
"merge-options": "^3.0.4",
"minimatch": "^5.0.0",
"normalize-path": "^3.0.0",
"p-map": "^4.0.0",
"path-exists": "^4.0.0",
"pkg-dir": "^5.0.0",
Expand All @@ -89,6 +90,7 @@
"@netlify/eslint-config-node": "^6.0.0",
"@types/archiver": "^5.1.1",
"@types/end-of-stream": "^1.4.1",
"@types/normalize-path": "^3.0.0",
"@types/resolve": "^1.20.1",
"@types/semver": "^7.3.8",
"@types/unixify": "^1.0.0",
Expand Down
10 changes: 5 additions & 5 deletions src/utils/matching.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { promisify } from 'util'

import globFunction from 'glob'
import minimatchFunction from 'minimatch'
import unixify from 'unixify'
import normalizePath from 'normalize-path'

const pGlob = promisify(globFunction)

Expand All @@ -16,14 +16,14 @@ export const glob = function (pattern: string, options: globFunction.IOptions):
if (options.ignore) {
normalizedIgnore =
typeof options.ignore === 'string'
? unixify(options.ignore)
: options.ignore.map((expression) => unixify(expression))
? normalizePath(options.ignore)
: options.ignore.map((expression) => normalizePath(expression))
}

console.log({ normalizedIgnore })
return pGlob(unixify(pattern), { ...options, ignore: normalizedIgnore })
return pGlob(normalizePath(pattern), { ...options, ignore: normalizedIgnore })
}

export const minimatch = function (target: string, pattern: string, options?: minimatchFunction.IOptions): boolean {
return minimatchFunction(target, unixify(pattern), options)
return minimatchFunction(target, normalizePath(pattern), options)
}

0 comments on commit 4776e68

Please sign in to comment.