hexo-all-minifier icon indicating copy to clipboard operation
hexo-all-minifier copied to clipboard

feat: replace minimatch with micromatch

Open curbengh opened this issue 4 years ago • 3 comments

micromatch is a replacement of minimatch. It supports multiple patterns in an array, without the need of string-to-array conversion, along with other globbing features.

Depends on Node 8 or above.

More details: https://github.com/hexojs/hexo/pull/3538

curbengh avatar Aug 05 '19 12:08 curbengh

Codecov Report

Merging #83 into master will decrease coverage by 0.17%. The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #83      +/-   ##
==========================================
- Coverage   94.73%   94.56%   -0.18%     
==========================================
  Files           5        5              
  Lines         190      184       -6     
==========================================
- Hits          180      174       -6     
  Misses         10       10
Impacted Files Coverage Δ
lib/concatJS.js 97.4% <ø> (ø) :arrow_up:
lib/optimizeCSS.js 100% <100%> (ø) :arrow_up:
lib/optimizeHTML.js 77.27% <100%> (-1.9%) :arrow_down:
lib/optimizeImage.js 97.14% <100%> (ø) :arrow_up:
lib/optimizeJS.js 90.9% <100%> (-0.76%) :arrow_down:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update d974eb3...e23c9eb. Read the comment docs.

codecov[bot] avatar Aug 05 '19 12:08 codecov[bot]

matchBase/basename option in micromatch only works with globbing pattern without slashes (e.g. '*.min.js'), so pattern like 'src/**/*' would only works when "basename" option is disabled.

One way to work around it is to let user customize the micromatch option, see https://github.com/okonet/lint-staged/pull/179 https://github.com/curbengh/hexo-yam/blob/7d06de7e7920b536083f4b5e9b93375ee57ea120/lib/filter.js#L27-L30

Alternatively, we could also detect whether the pattern contains a slash and disable "basename" accordingly.

curbengh avatar Aug 05 '19 12:08 curbengh

hey there are some conflicts, can you please have a see? Also, can you update the readme for using micromatch?

chenzhutian avatar Oct 08 '20 11:10 chenzhutian