Skip to content

Commit 37b368e

Browse files
committed
update file matching
1 parent 2a3342f commit 37b368e

File tree

2 files changed

+16
-10
lines changed

2 files changed

+16
-10
lines changed

scripts/add-platform-exports.js

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -300,12 +300,15 @@ function findSourceFiles(dir, files = []) {
300300
for (const entry of entries) {
301301
const fullPath = path.join(dir, entry.name);
302302

303-
// Skip hidden directories, node_modules, dist, and coverage
304303
if (entry.isDirectory()) {
305-
if (!entry.name.startsWith('.') &&
306-
entry.name !== 'node_modules' &&
307-
entry.name !== 'dist' &&
308-
entry.name !== 'coverage') {
304+
// Check if this directory path could potentially contain files matching include patterns
305+
// Use minimatch with partial mode to test if pattern could match files under this directory
306+
const relativePath = path.relative(WORKSPACE_ROOT, fullPath).replace(/\\/g, '/');
307+
const couldMatch = config.include.some(pattern => {
308+
return minimatch(relativePath, pattern, { partial: true });
309+
});
310+
311+
if (couldMatch) {
309312
findSourceFiles(fullPath, files);
310313
}
311314
} else if (entry.isFile()) {

scripts/validate-platform-isolation-ts.js

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -463,12 +463,15 @@ function findSourceFiles(dir, files = []) {
463463
for (const entry of entries) {
464464
const fullPath = path.join(dir, entry.name);
465465

466-
// Skip hidden directories, node_modules, dist, and coverage
467466
if (entry.isDirectory()) {
468-
if (!entry.name.startsWith('.') &&
469-
entry.name !== 'node_modules' &&
470-
entry.name !== 'dist' &&
471-
entry.name !== 'coverage') {
467+
// Check if this directory path could potentially contain files matching include patterns
468+
// Use minimatch with partial mode to test if pattern could match files under this directory
469+
const relativePath = path.relative(WORKSPACE_ROOT, fullPath).replace(/\\/g, '/');
470+
const couldMatch = config.include.some(pattern => {
471+
return minimatch(relativePath, pattern, { partial: true });
472+
});
473+
474+
if (couldMatch) {
472475
findSourceFiles(fullPath, files);
473476
}
474477
} else if (entry.isFile()) {

0 commit comments

Comments
 (0)