Skip to content

Commit 109d310

Browse files
authored
Merge pull request #31407 from benmccann/tinyglobby-codemod
Codemod: Replace `globby` with `tinyglobby`
2 parents bc6faab + 6a5711c commit 109d310

File tree

3 files changed

+5
-8
lines changed

3 files changed

+5
-8
lines changed

code/lib/codemod/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,11 @@
4747
"@types/cross-spawn": "^6.0.6",
4848
"cross-spawn": "^7.0.6",
4949
"es-toolkit": "^1.36.0",
50-
"globby": "^14.0.1",
5150
"jscodeshift": "^0.15.1",
5251
"prettier": "^3.5.3",
5352
"storybook": "workspace:*",
54-
"tiny-invariant": "^1.3.1"
53+
"tiny-invariant": "^1.3.1",
54+
"tinyglobby": "^0.2.13"
5555
},
5656
"devDependencies": {
5757
"@types/jscodeshift": "^0.11.10",

code/lib/codemod/src/index.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import { extname, join } from 'node:path';
66
import { resolvePackageDir } from 'storybook/internal/common';
77

88
import { sync as spawnSync } from 'cross-spawn';
9+
import { glob as tinyglobby } from 'tinyglobby';
910

1011
import { jscodeshiftToPrettierParser } from './lib/utils';
1112

@@ -59,11 +60,7 @@ export async function runCodemod(
5960
}
6061
}
6162

62-
// Dynamically import globby because it is a pure ESM module
63-
// eslint-disable-next-line depend/ban-dependencies
64-
const { globby } = await import('globby');
65-
66-
const files = await globby([glob, '!**/node_modules', '!**/dist']);
63+
const files = await tinyglobby([glob, '!**/node_modules', '!**/dist']);
6764
const extensions = new Set(files.map((file) => extname(file).slice(1)));
6865
const commaSeparatedExtensions = Array.from(extensions).join(',');
6966

code/yarn.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6297,11 +6297,11 @@ __metadata:
62976297
ansi-regex: "npm:^6.0.1"
62986298
cross-spawn: "npm:^7.0.6"
62996299
es-toolkit: "npm:^1.36.0"
6300-
globby: "npm:^14.0.1"
63016300
jscodeshift: "npm:^0.15.1"
63026301
prettier: "npm:^3.5.3"
63036302
storybook: "workspace:*"
63046303
tiny-invariant: "npm:^1.3.1"
6304+
tinyglobby: "npm:^0.2.13"
63056305
ts-dedent: "npm:^2.2.0"
63066306
typescript: "npm:^5.8.3"
63076307
languageName: unknown

0 commit comments

Comments
 (0)