Skip to content

Commit

Permalink
Merge pull request #85 from likun7981/fix/extGlobs
Browse files Browse the repository at this point in the history
fix(core): ext globs should use **/*.ext otherwise **.ext
  • Loading branch information
likun7981 authored Aug 2, 2022

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
2 parents fc2787c + 24912c1 commit 681dd42
Showing 5 changed files with 10 additions and 8 deletions.
1 change: 1 addition & 0 deletions packages/core/package.json
Original file line number Diff line number Diff line change
@@ -24,6 +24,7 @@
"clean": "rm -rf lib",
"cp": "cp src/config/hlink.config.tpl lib/config/hlink.config.tpl",
"build": "npm run clean && tsc && npm run cp",
"dev": "npm run clean && tsc -w",
"prepublishOnly": "npm run build && vitest run"
},
"files": [
2 changes: 1 addition & 1 deletion packages/core/src/__tests__/config/format.spec.ts
Original file line number Diff line number Diff line change
@@ -85,7 +85,7 @@ describe('format test', () => {
{
"exclude": [],
"include": [
"**.mkv",
"**/*.mkv",
],
"pathsMapping": {
"/a": "/b",
12 changes: 6 additions & 6 deletions packages/core/src/__tests__/utils/getGlobs.spec.ts
Original file line number Diff line number Diff line change
@@ -12,8 +12,8 @@ describe('getGlobs test', () => {
})
).toMatchInlineSnapshot(`
[
"**.mkv",
"**.mp4",
"**/*.mkv",
"**/*.mp4",
]
`)
})
@@ -38,8 +38,8 @@ describe('getGlobs test', () => {
).toMatchInlineSnapshot(`
[
"**/a/**",
"**.mkv",
"**.mp4",
"**/*.mkv",
"**/*.mp4",
]
`)
})
@@ -56,8 +56,8 @@ describe('getGlobs test', () => {
test('should be passed with exts array string', () => {
expect(getGlobs(['ext3', 'ext2'])).toMatchInlineSnapshot(`
[
"**.ext3",
"**.ext2",
"**/*.ext3",
"**/*.ext2",
]
`)
})
2 changes: 1 addition & 1 deletion packages/core/src/utils/getGlobs.ts
Original file line number Diff line number Diff line change
@@ -16,7 +16,7 @@ const getGlobs = (
let { globs, exts } = options || {}
globs = globs || []
if (exts) {
globs = globs.concat(exts.map((ext) => `**.${ext}`))
globs = globs.concat(exts.map((ext) => `**/*.${ext}`))
}
if (!globs.length) {
globs = globs.concat(defaultGlobs)
1 change: 1 addition & 0 deletions packages/core/src/utils/supported.ts
Original file line number Diff line number Diff line change
@@ -3,6 +3,7 @@ import micromatch from 'micromatch'
function supported(path: string, include: string[], exclude: string[]) {
return micromatch.isMatch(path.toLowerCase(), include, {
ignore: exclude,
nocase: true,
})
}

1 comment on commit 681dd42

@vercel
Copy link

@vercel vercel bot commented on 681dd42 Aug 2, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.