Skip to content
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

Upgrade fast-glob package to v3 #126

Merged
merged 7 commits into from
Jun 29, 2019
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
'use strict';
const fs = require('fs');
const path = require('path');
const arrayUnion = require('array-union');
const merge2 = require('merge2');
const glob = require('glob');
Expand All @@ -24,7 +25,7 @@ const checkCwdOption = options => {
}
};

const getPathString = p => p instanceof fs.Stats ? p.path : p;
const getPathString = p => p.stats instanceof fs.Stats ? p.path : p;

const generateGlobTasks = (patterns, taskOptions) => {
patterns = arrayUnion([].concat(patterns));
Expand Down Expand Up @@ -89,14 +90,16 @@ const getFilterSync = options => {
DEFAULT_FILTER;
};

const normalizeGlob = glob => glob.split(path.sep).join(path.posix.sep);
Copy link
Owner

Choose a reason for hiding this comment

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

Note:

Only forward-slashes in glob expression. Previously, we convert all slashes to the forward-slashes, which did not allow the use of escaping. See pattern syntax section in the README.md file. - https://github.com/mrmlnc/fast-glob/releases/tag/3.0.0

I don't think we should override that as the change was done for a good reason. Instead, we should update the tests and docs.

Copy link
Contributor Author

@yhatt yhatt Jun 26, 2019

Choose a reason for hiding this comment

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

I agree. An only concern at here is the glob pattern generated by dir-glob. It includes unexpected backslashes because of using path.join in Windows. (kevva/dir-glob#17)


const globToTask = task => glob => {
const {options} = task;
if (options.ignore && Array.isArray(options.ignore) && options.expandDirectories) {
options.ignore = dirGlob.sync(options.ignore);
options.ignore = dirGlob.sync(options.ignore).map(normalizeGlob);
}

return {
pattern: glob,
pattern: normalizeGlob(glob),
options
};
};
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
"@types/glob": "^7.1.1",
"array-union": "^2.1.0",
"dir-glob": "^2.2.2",
"fast-glob": "^2.2.6",
"fast-glob": "^3.0.2",
"glob": "^7.1.3",
"ignore": "^5.1.1",
"merge2": "^1.2.3",
Expand Down