Skip to content

Commit 25b29f0

Browse files
committed
react-native: Switch scripts to tinyglobby
1 parent 2d0f767 commit 25b29f0

3 files changed

Lines changed: 15 additions & 11 deletions

File tree

packages/react-native/scripts/codegen/generate-artifacts-executor/generateSchemaInfos.js

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313
const CodegenUtils = require('../codegen-utils');
1414
const {codegenLog} = require('./utils');
1515
const fs = require('fs');
16-
const glob = require('glob');
1716
const path = require('path');
17+
const {globSync} = require('tinyglobby');
1818

1919
function generateSchemaInfos(
2020
libraries /*: $ReadOnlyArray<$FlowFixMe> */,
@@ -57,17 +57,18 @@ function extractSupportedApplePlatforms(
5757
dependencyPath /*: string */,
5858
) /*: ?{[string]: boolean} */ {
5959
codegenLog('Searching for podspec in the project dependencies.', true);
60-
const podspecs = glob.sync('*.podspec', {cwd: dependencyPath});
60+
const podspecs = globSync('*.podspec', {
61+
cwd: dependencyPath,
62+
onlyFiles: true,
63+
absolute: true,
64+
});
6165

6266
if (podspecs.length === 0) {
6367
return;
6468
}
6569

6670
// Take the first podspec found
67-
const podspec = fs.readFileSync(
68-
path.join(dependencyPath, podspecs[0]),
69-
'utf8',
70-
);
71+
const podspec = fs.readFileSync(podspecs[0], 'utf8');
7172

7273
/**
7374
* Podspec can have platforms defined in two ways:

packages/react-native/scripts/ios-prebuild/build.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ import type {BuildFlavor, Destination} from './types';
1515
const {createLogger} = require('./utils');
1616
const {execSync} = require('child_process');
1717
const fs = require('fs');
18-
const glob = require('glob');
1918
const path = require('path');
19+
const {globSync} = require('tinyglobby');
2020

2121
const buildLog = createLogger('SPM');
2222

@@ -28,8 +28,9 @@ function computeFrameworkPaths(
2828
productsFolder /*: string */,
2929
) /*: Array<string> */ {
3030
// The frameworks are in the products folder under a platform/buildType folder and are directories ending with .framework
31-
const frameworks = glob.sync('**/*.framework', {
31+
const frameworks = globSync('**/*.framework', {
3232
cwd: productsFolder,
33+
expandDirectories: false,
3334
absolute: true,
3435
});
3536

packages/react-native/scripts/ios-prebuild/headers.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
*/
1010

1111
const fs = require('fs');
12-
const glob = require('glob');
1312
const path = require('path');
13+
const {globSync} = require('tinyglobby');
1414

1515
/**
1616
* This regular expression is designed to match function calls to `podspec_sources` within a podspec file.
@@ -32,9 +32,10 @@ function getHeaderFilesFromPodspecs(
3232
rootFolder /*:string*/,
3333
) /*: { [key: string]: string[] }*/ {
3434
// Find podspec files
35-
const podSpecFiles = glob.sync('**/*.podspec', {
35+
const podSpecFiles = globSync('**/*.podspec', {
3636
cwd: rootFolder,
3737
absolute: true,
38+
onlyFiles: true,
3839
});
3940

4041
const headers /*: { [key: string]: string[] }*/ = {};
@@ -66,9 +67,10 @@ function getHeaderFilesFromPodspecs(
6667
const p = path.resolve(process.cwd(), path.dirname(podspec));
6768
const results = globPatterns
6869
.map(g => {
69-
return glob.sync(g.replace('{h}', 'h'), {
70+
return globSync(g.replace('{h}', 'h'), {
7071
cwd: p,
7172
absolute: true,
73+
expandDirectories: false,
7274
});
7375
})
7476
.flat();

0 commit comments

Comments
 (0)