Skip to content

Commit afbb54c

Browse files
committed
Fix up ignore patterns by only matching exact files
A difference between `glob` and `tinyglob` is how `ignore` is applied. `glob` has an exception that only applies `.../*` patterns to files. `tinyglobby` doesn't make this distinction and hence that'd also exclude directories to be traversed. Patterns have been adjusted to account for this.
1 parent 574cda0 commit afbb54c

2 files changed

Lines changed: 15 additions & 19 deletions

File tree

scripts/cxx-api/public-api.conf

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,14 @@ packages/react-native/**/*.h
1313
[exclude]
1414
; Collection of paths we're sure aren't part of the public API. These
1515
; will always override anything in [include].
16-
packages/react-native/ReactCommon/jsinspector-modern/tests/*
17-
packages/react-native/ReactCommon/react/Nativemodule/samples/*
18-
packages/react-native/ReactCommon/react/test_utils/*
19-
packages/react-native/ReactCommon/react/utils/*
20-
packages/react-native/ReactCommon/react/featureflags/*
21-
packages/react-native/Libraries/WebSocket/*
22-
packages/react-native/Libraries/Wrapper/Example/*
16+
; Patterns end in *.h to only match exact files and never directories
17+
packages/react-native/ReactCommon/jsinspector-modern/tests/*.h
18+
packages/react-native/ReactCommon/react/Nativemodule/samples/*.h
19+
packages/react-native/ReactCommon/react/test_utils/*.h
20+
packages/react-native/ReactCommon/react/utils/*.h
21+
packages/react-native/ReactCommon/react/featureflags/*.h
22+
packages/react-native/Libraries/WebSocket/*.h
23+
packages/react-native/Libraries/Wrapper/Example/*.h
2324

2425
[settings]
2526
output=scripts/cxx-api/ReactNativeCPP.api

scripts/cxx-api/public-api.js

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -179,18 +179,13 @@ function main() {
179179

180180
let start = performance.now();
181181

182-
let files /*: string[]*/ = [];
183-
for (const searchGlob of config.include) {
184-
// glob 7 doesn't support searchGlob as a string[]
185-
files = files.concat(
186-
globSync(searchGlob, {
187-
ignore: config.exclude,
188-
cwd: GLOB_PROJECT_ROOT,
189-
expandDirectories: false,
190-
}),
191-
);
192-
}
193-
files = Array.from(new Set(files));
182+
const files = globSync(config.include, {
183+
// WARN: Unlike glob, this will exclude directories to be traversed too right now
184+
// This means that glob patterns in here must match exact files only
185+
ignore: config.exclude,
186+
cwd: GLOB_PROJECT_ROOT,
187+
expandDirectories: false,
188+
});
194189

195190
// Sort the files to make the output deterministic
196191
files.sort();

0 commit comments

Comments
 (0)