-
Notifications
You must be signed in to change notification settings - Fork 81
Replace glob by tinyglobby #647
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
Changes from 2 commits
9f7de94
119168a
7814ff7
46ca4aa
36cdb47
2f74665
494a435
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 |
|---|---|---|
|
|
@@ -2,7 +2,7 @@ | |
|
|
||
| const gracefulFs = require('graceful-fs'); | ||
| const fs = require('fs'); | ||
| const glob = require('glob'); | ||
| const { globSync } = require('tinyglobby'); | ||
| const path = require('path'); | ||
| const Parser = require('./Parser'); | ||
| const Project = require('./Project'); | ||
|
|
@@ -74,29 +74,27 @@ function resolveCliArgGlob( | |
| ? globRelativeToProjectRoot.replace(/\\/g, '/') | ||
| : globRelativeToProjectRoot; | ||
|
|
||
| return glob | ||
| .sync(pattern, { | ||
| cwd: projectRootDir, | ||
| nocase: true, | ||
| absolute: true, | ||
| ignore: ignoredDirsGlobs, | ||
| // Match directories as well and mark them with a trailing slash. | ||
| nodir: false, | ||
| mark: true, | ||
| }) | ||
| .flatMap((filePath) => | ||
| filePath.endsWith('/') ? findAllElmFilesInDir(filePath) : filePath | ||
| ); | ||
| return globSync(pattern, { | ||
| cwd: projectRootDir, | ||
| caseSensitiveMatch: false, | ||
| absolute: true, | ||
| ignore: ignoredDirsGlobs, | ||
| // Match directories as well | ||
| onlyFiles: false, | ||
| }).flatMap((filePath) => | ||
| // Directories have their path end with `/` | ||
| filePath.endsWith('/') ? findAllElmFilesInDir(filePath) : filePath | ||
|
Collaborator
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. Note to self: Does it end with a slash on Windows? We don’t seem to have test coverage for this condition being true.
Collaborator
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. Added test case: Btw, that test was failing on master – see #648. But it passed when installing glob 8 instead of 10. Another breakage by glob 🙈 |
||
| ); | ||
| } | ||
|
|
||
| // Recursively search for *.elm files. | ||
| function findAllElmFilesInDir(dir /*: string */) /*: Array<string> */ { | ||
| return glob.sync('**/*.elm', { | ||
| return globSync('**/*.elm', { | ||
| cwd: dir, | ||
| nocase: true, | ||
| caseSensitiveMatch: false, | ||
| absolute: true, | ||
| ignore: ignoredDirsGlobs, | ||
| nodir: true, | ||
| onlyFiles: true, | ||
|
Contributor
Author
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.
|
||
| }); | ||
| } | ||
|
|
||
|
|
||
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.
Note to self: there a big comment above about glob@8 and Windows and backslashes. Try it out on Windows to see how it behaves in tinyglobby, and remove or update the code/comment?
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.
It’s needed:
7814ff7(#647)Updated the comment:
46ca4aa(#647)