-
Notifications
You must be signed in to change notification settings - Fork 828
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
Default the glob options follow & strict to true, with new options to override #1104
Changes from 4 commits
0dbe0a4
9077a55
9366e95
3129073
bd8e932
b317257
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -132,6 +132,19 @@ import './_version.mjs'; | |
* | ||
* E.g. `['**\/ignored.html']` | ||
* | ||
* @property {Boolean} [globFollow=true] Follow symlinked directories when | ||
* expanding ** patterns. Note that this can result in a lot of duplicate | ||
* references in the presence of cyclic links. | ||
* | ||
* E.g. `true` | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you remove the e.g. |
||
* | ||
* @property {Boolean} [globStrict=true] When an unusual error is encountered | ||
* when attempting to read a directory, the process will just continue on in | ||
* search of other matches. Set the strict option to raise an error in these | ||
* cases. | ||
* | ||
* E.g. `true` | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please remove this - Our JSDocs will call out the default value. |
||
* | ||
* @property {Object<String,Array|string>} [templatedUrls] | ||
* If a URL is rendered generated based on some server-side logic, its contents | ||
* may depend on multiple files or on some other unique string value. | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,12 +21,22 @@ const errors = require('./errors'); | |
const getFileSize = require('./get-file-size'); | ||
const getFileHash = require('./get-file-hash'); | ||
|
||
module.exports = ({globDirectory, globIgnores, globPattern}) => { | ||
module.exports = (globOptions) => { | ||
const { | ||
globDirectory, | ||
globIgnores, | ||
globPattern, | ||
globFollow, | ||
globStrict, | ||
} = globOptions; | ||
let globbedFiles; | ||
try { | ||
globbedFiles = glob.sync(globPattern, { | ||
cwd: globDirectory, | ||
ignore: globIgnores, | ||
follow: typeof globFollow !== 'undefined'? globFollow : true, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @jeffposnick you've been doing some work on the defaults, is this the best approach or should this be moved to a defaults value. |
||
strict: typeof globStrict !== 'undefined'? globStrict : true, | ||
|
||
}); | ||
} catch (err) { | ||
throw new Error(errors['unable-to-glob-files'] + ` '${err.message}'`); | ||
|
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.
Could you add single quotes around the patterns like: '**'