Skip to content

Commit 1455259

Browse files
committed
chore: replace glob with tinyglobby
Tests got rate-limited, so I'm just pushing. I think doesn't quite work yet.
1 parent f9a57e4 commit 1455259

File tree

12 files changed

+34
-43
lines changed

12 files changed

+34
-43
lines changed

.eslintrc.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,7 @@ module.exports = {
177177
rules: {
178178
'n/no-process-exit': 'off',
179179
'n/no-missing-require': 'off', // `require` of `elm.json`.
180+
'n/no-extraneous-require': ['error', {allowModules: ['fs-extra']}],
180181
'@typescript-eslint/ban-ts-comment': 'off' // `require` of `elm.json`.
181182
}
182183
},

.github/dependabot.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,6 @@ updates:
5151
- dependency-name: 'eslint-plugin-unicorn'
5252
update-types:
5353
- version-update:semver-major
54-
- dependency-name: 'glob'
55-
update-types:
56-
- version-update:semver-major
5754
- dependency-name: 'which'
5855
update-types:
5956
- version-update:semver-major

lib/elm-files.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
*/
66
const path = require('node:path');
77
const chalk = require('chalk');
8-
const {glob} = require('glob');
8+
const {glob} = require('tinyglobby');
99
const Anonymize = require('./anonymize');
1010
const Benchmark = require('./benchmark');
1111
const Cache = require('./cache');
@@ -308,9 +308,9 @@ async function findForCliArguments(directory, path_) {
308308
// For finding files when `directory` is a direct Elm file, like "src/File.elm"
309309
return {
310310
files: await glob(path_, {
311-
nocase: true,
311+
caseSensitiveMatch: false,
312312
ignore: globIgnore,
313-
nodir: true
313+
onlyFiles: false
314314
}),
315315
directory
316316
};
@@ -342,9 +342,9 @@ async function findForCliArguments(directory, path_) {
342342
async function findFromFolder(directory, path_) {
343343
return {
344344
files: await glob(`${path_}/**/*.elm`, {
345-
nocase: true,
345+
caseSensitiveMatch: false,
346346
ignore: globIgnore,
347-
nodir: false
347+
onlyFiles: false
348348
}),
349349
directory
350350
};

lib/new-package.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -465,8 +465,8 @@ function packageJson(options, packageName) {
465465
'elm-test': '^0.19.1-revision10',
466466
'elm-tooling': '^1.13.1',
467467
'fs-extra': '^9.0.0',
468-
glob: '^9.3.1',
469-
'npm-run-all': '^4.1.5'
468+
'npm-run-all': '^4.1.5',
469+
tinyglobby: '^0.2.10'
470470
}
471471
};
472472
}

lib/new-rule.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
*/
55
const path = require('node:path');
66
const chalk = require('chalk');
7-
const {glob} = require('glob');
7+
const {globSync} = require('tinyglobby');
88
const fs = require('graceful-fs');
99
const prompts = require('prompts');
1010
const ErrorMessage = require('./error-message');
@@ -234,12 +234,12 @@ async function addRule(options, elmJson, ruleName, ruleType) {
234234
}
235235
}
236236

237-
const globbed = glob.sync(
237+
const globbed = globSync(
238238
OsHelpers.makePathOsAgnostic(`${dir}/preview*/**/elm.json`),
239239
{
240-
nocase: true,
240+
caseSensitiveMatch: false,
241241
ignore: ['**/elm-stuff/**'],
242-
nodir: false
242+
onlyFiles: false
243243
}
244244
);
245245

lib/suppressed-errors.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
const childProcess = require('node:child_process');
77
const path = require('node:path');
88
const chalk = require('chalk');
9-
const {glob} = require('glob');
9+
const {glob} = require('tinyglobby');
1010
const exit = require('../vendor/exit');
1111
const ErrorMessage = require('./error-message');
1212
const FS = require('./fs-wrapper');
@@ -139,9 +139,9 @@ async function read(options) {
139139
`${options.suppressedErrorsFolder()}/**/*.json`
140140
);
141141
let files = await glob(pattern, {
142-
nocase: true,
142+
caseSensitiveMatch: false,
143143
ignore: ['**/elm-stuff/**'],
144-
nodir: false
144+
onlyFiles: false
145145
});
146146

147147
if (options.rulesFilter) {

new-package/elm-review-package-tests/helpers/find-configurations.js

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
const path = require('node:path');
2-
const {glob} = require('glob');
2+
const {globSync} = require('tinyglobby');
33

44
const root = path
55
.resolve(__dirname, '../../')
@@ -10,12 +10,10 @@ const root = path
1010
* @returns {string[]}
1111
*/
1212
function findPreviewConfigurations() {
13-
return glob
14-
.sync(`${root}/preview*/**/elm.json`, {
15-
ignore: ['**/elm-stuff/**'],
16-
nodir: true
17-
})
18-
.map((val) => path.dirname(val));
13+
return globSync(`${root}/preview*/**/elm.json`, {
14+
ignore: ['**/elm-stuff/**'],
15+
onlyFiles: false
16+
}).map((val) => path.dirname(val));
1917
}
2018

2119
module.exports = {

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,6 @@
6767
"fastest-levenshtein": "^1.0.16",
6868
"find-up": "^4.1.0 || ^5.0.0",
6969
"folder-hash": "^3.3.0",
70-
"glob": "^10.2.6",
7170
"got": "^11.8.5",
7271
"graceful-fs": "^4.2.11",
7372
"minimist": "^1.2.6",

test/run-snapshots/elm-review-something-for-new-rule/elm-review-package-tests/helpers/find-configurations.js

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
const path = require('node:path');
2-
const {glob} = require('glob');
2+
const {globSync} = require('tinyglobby');
33

44
const root = path
55
.resolve(__dirname, '../../')
@@ -10,12 +10,10 @@ const root = path
1010
* @returns {string[]}
1111
*/
1212
function findPreviewConfigurations() {
13-
return glob
14-
.sync(`${root}/preview*/**/elm.json`, {
15-
ignore: ['**/elm-stuff/**'],
16-
nodir: true
17-
})
18-
.map((val) => path.dirname(val));
13+
return globSync(`${root}/preview*/**/elm.json`, {
14+
ignore: ['**/elm-stuff/**'],
15+
onlyFiles: false
16+
}).map((val) => path.dirname(val));
1917
}
2018

2119
module.exports = {

test/run-snapshots/elm-review-something-for-new-rule/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@
1919
"elm-test": "^0.19.1-revision10",
2020
"elm-tooling": "^1.13.1",
2121
"fs-extra": "^9.0.0",
22-
"glob": "^9.3.1",
23-
"npm-run-all": "^4.1.5"
22+
"npm-run-all": "^4.1.5",
23+
"tinyglobby": "^0.2.10"
2424
},
2525
"license": "BSD-3-Clause"
2626
}

0 commit comments

Comments
 (0)