-
-
Notifications
You must be signed in to change notification settings - Fork 4.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
refactor: switch minimatch to micromatch #3538
Conversation
@weyusi |
I like the idea and your arguments are valid, @weyusi. Thank you for the idea and PR. |
Edit: I just tested matchBase option. While it's useful to ignore a filename in any folder, it doesn't work if a folder needs to be specified (e.g. |
This reverts commit b239114. See hexojs/hexo#3538 (comment)
I've rebased. Ready to be reviewed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tested it and it worked 👍🏻
Thank you @weyusi
What does it do?
micromatch is a replacement of minimatch. It supports multiple patterns in an array, without string-to-array conversion, along with other globbing features. It's also faster and updated much more frequently (micromatch vs minimatch). It's already utilized in hexo, indirectly through chokidar dep.
npm ls --depth 5
shows 4 instances of it.Using micromatch@4 is rather drastic since it depends on Node >=8, considering other deps currently use micromatch@3. But it's not a major issue, as Node 6 will be eventually dropped (#3508).
Personally, I would prefer to enable the matchBase option. With this option, I can just use'ignore-this.txt'
to exclude that file (assuming the filename is unique. I'm aware of the underscore ignore), instead of'**/ignore-this.txt'
. When globbing is used, if I want to exclude all.txt
, I only need'*.txt'
, instead of'**/*.txt'
. In the case of #3306, it can be just'abc*'
. The doc needs to be updated though if this behavior is introduced.How to test
github page: https://github.com/weyusi/hexo-testing
Pull request tasks