Skip to content

Commit fd7526c

Browse files
committed
Replace glob by tinyglobby
1 parent 01ed41e commit fd7526c

File tree

4 files changed

+61
-93
lines changed

4 files changed

+61
-93
lines changed

lib/FindTests.js

Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
const gracefulFs = require('graceful-fs');
44
const fs = require('fs');
5-
const glob = require('glob');
5+
const { globSync } = require('tinyglobby');
66
const path = require('path');
77
const Parser = require('./Parser');
88
const Project = require('./Project');
@@ -74,29 +74,27 @@ function resolveCliArgGlob(
7474
? globRelativeToProjectRoot.replace(/\\/g, '/')
7575
: globRelativeToProjectRoot;
7676

77-
return glob
78-
.sync(pattern, {
79-
cwd: projectRootDir,
80-
nocase: true,
81-
absolute: true,
82-
ignore: ignoredDirsGlobs,
83-
// Match directories as well and mark them with a trailing slash.
84-
nodir: false,
85-
mark: true,
86-
})
87-
.flatMap((filePath) =>
88-
filePath.endsWith('/') ? findAllElmFilesInDir(filePath) : filePath
89-
);
77+
return globSync(pattern, {
78+
cwd: projectRootDir,
79+
caseSensitiveMatch: false,
80+
absolute: true,
81+
ignore: ignoredDirsGlobs,
82+
// Match directories as well
83+
onlyFiles: false
84+
}).flatMap((filePath) =>
85+
// Directories have their path end with `/`
86+
filePath.endsWith('/') ? findAllElmFilesInDir(filePath) : filePath
87+
);
9088
}
9189

9290
// Recursively search for *.elm files.
9391
function findAllElmFilesInDir(dir /*: string */) /*: Array<string> */ {
94-
return glob.sync('**/*.elm', {
92+
return globSync('**/*.elm', {
9593
cwd: dir,
96-
nocase: true,
94+
caseSensitiveMatch: false,
9795
absolute: true,
9896
ignore: ignoredDirsGlobs,
99-
nodir: true,
97+
onlyFiles: true,
10098
});
10199
}
102100

package-lock.json

Lines changed: 43 additions & 73 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)