Skip to content

Commit 8c21c94

Browse files
committed
refactor: switch to tinyglobby
1 parent cb66124 commit 8c21c94

File tree

16 files changed

+83
-43
lines changed

16 files changed

+83
-43
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@
4141
"eslint-plugin-ft-flow": "^2.0.1",
4242
"eslint-plugin-import": "^2.25.3",
4343
"execa": "^5.0.0",
44-
"fast-glob": "^3.3.2",
4544
"husky": "^8.0.2",
4645
"jest": "^26.6.2",
4746
"jest-circus": "^26.6.2",
@@ -53,6 +52,7 @@
5352
"prettier": "2.8.8",
5453
"slash": "^3.0.0",
5554
"string-length": "^2.0.0",
55+
"tinyglobby": "^0.2.14",
5656
"typescript": "^5.2.0"
5757
},
5858
"resolutions": {

packages/cli-clean/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"@react-native-community/cli-tools": "19.0.0",
1212
"chalk": "^4.1.2",
1313
"execa": "^5.0.0",
14-
"fast-glob": "^3.3.2"
14+
"tinyglobby": "^0.2.14"
1515
},
1616
"files": [
1717
"build",

packages/cli-clean/src/clean.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import {existsSync as fileExists, rm} from 'fs';
66
import os from 'os';
77
import path from 'path';
88
import {promisify} from 'util';
9-
import glob from 'fast-glob';
9+
import glob from 'tinyglobby';
1010

1111
type Args = {
1212
include?: string;
@@ -38,7 +38,10 @@ function isDirectoryPattern(directory: string): boolean {
3838
export async function cleanDir(directory: string): Promise<void> {
3939
try {
4040
if (isDirectoryPattern(directory)) {
41-
const directories = await glob.async(directory, {onlyFiles: false});
41+
const directories = await glob.glob(directory, {
42+
onlyFiles: false,
43+
expandDirectories: false,
44+
});
4245

4346
for (const dir of directories) {
4447
await rmAsync(dir, rmAsyncOptions);

packages/cli-config-android/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
"dependencies": {
1010
"@react-native-community/cli-tools": "19.0.0",
1111
"chalk": "^4.1.2",
12-
"fast-glob": "^3.3.2",
13-
"fast-xml-parser": "^4.4.1"
12+
"fast-xml-parser": "^4.4.1",
13+
"tinyglobby": "^0.2.14"
1414
},
1515
"files": [
1616
"build",

packages/cli-config-android/src/config/findComponentDescriptors.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import fs from 'fs';
22
import path from 'path';
3-
import glob from 'fast-glob';
3+
import glob from 'tinyglobby';
44
import {extractComponentDescriptors} from './extractComponentDescriptors';
55
import {unixifyPaths} from '@react-native-community/cli-tools';
66

@@ -18,9 +18,9 @@ export function findComponentDescriptors(packageRoot: string) {
1818
const globPattern = jsSrcsDir
1919
? `${jsSrcsDir}/**/+(*.js|*.jsx|*.ts|*.tsx)`
2020
: '**/+(*.js|*.jsx|*.ts|*.tsx)';
21-
const files = glob.sync(globPattern, {
21+
const files = glob.globSync(globPattern, {
2222
cwd: unixifyPaths(packageRoot),
23-
onlyFiles: true,
23+
expandDirectories: false,
2424
ignore: ['**/node_modules/**'],
2525
});
2626
const codegenComponent = files

packages/cli-config-android/src/config/findManifest.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,14 @@
66
*
77
*/
88

9-
import glob from 'fast-glob';
9+
import glob from 'tinyglobby';
1010
import path from 'path';
1111
import {unixifyPaths} from '@react-native-community/cli-tools';
1212

1313
export default function findManifest(folder: string) {
14-
let manifestPaths = glob.sync('**/AndroidManifest.xml', {
14+
let manifestPaths = glob.globSync('**/AndroidManifest.xml', {
1515
cwd: unixifyPaths(folder),
16+
expandDirectories: false,
1617
ignore: [
1718
'**/build/**',
1819
'**/debug/**',

packages/cli-config-android/src/config/findPackageClassName.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*/
88

99
import fs from 'fs';
10-
import glob from 'fast-glob';
10+
import glob from 'tinyglobby';
1111
import path from 'path';
1212
import {unixifyPaths} from '@react-native-community/cli-tools';
1313

@@ -23,9 +23,9 @@ export function getMainActivityFiles(
2323
patternArray.push('*.java', '*.kt');
2424
}
2525

26-
return glob.sync(`**/+(${patternArray.join('|')})`, {
26+
return glob.globSync(`**/+(${patternArray.join('|')})`, {
2727
cwd: unixifyPaths(folder),
28-
onlyFiles: true,
28+
expandDirectories: false,
2929
ignore: ['**/.cxx/**'],
3030
});
3131
}

packages/cli-config-apple/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"@react-native-community/cli-tools": "19.0.0",
1111
"chalk": "^4.1.2",
1212
"execa": "^5.0.0",
13-
"fast-glob": "^3.3.2"
13+
"tinyglobby": "^0.2.14"
1414
},
1515
"devDependencies": {
1616
"@react-native-community/cli-types": "19.0.0",

packages/cli-config-apple/src/config/findAllPodfilePaths.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* LICENSE file in the root directory of this source tree.
66
*
77
*/
8-
import glob from 'fast-glob';
8+
import glob from 'tinyglobby';
99
import {unixifyPaths} from '@react-native-community/cli-tools';
1010

1111
// These folders will be excluded from search to speed it up
@@ -14,8 +14,9 @@ const GLOB_EXCLUDE_PATTERN = [
1414
];
1515

1616
export default function findAllPodfilePaths(cwd: string) {
17-
return glob.sync('**/Podfile', {
17+
return glob.globSync('**/Podfile', {
1818
cwd: unixifyPaths(cwd),
19+
expandDirectories: false,
1920
ignore: GLOB_EXCLUDE_PATTERN,
2021
// Stop unbounded globbing and infinite loops for projects
2122
// with deeply nested subdirectories. The most likely result

packages/cli-config-apple/src/config/findPodspec.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
1-
import glob from 'fast-glob';
1+
import glob from 'tinyglobby';
22
import path from 'path';
33
import {unixifyPaths} from '@react-native-community/cli-tools';
44

55
export default function findPodspec(folder: string): string | null {
6-
const podspecs = glob.sync('*.podspec', {cwd: unixifyPaths(folder)});
6+
const podspecs = glob.globSync('*.podspec', {
7+
cwd: unixifyPaths(folder),
8+
expandDirectories: false,
9+
});
710

811
if (podspecs.length === 0) {
912
return null;

0 commit comments

Comments
 (0)