-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Build: Fix glob ignore patterns in dot-prefixed directories #75114
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: trunk
Are you sure you want to change the base?
Conversation
Add `dot: true` option to fast-glob calls in transpilePackage to ensure ignore patterns (like `**/*.native.*`) work correctly when the repository path contains directories starting with a dot, such as `.worktrees/`. Without this option, fast-glob's ignore patterns fail to match files inside dot-prefixed directories, causing platform-specific files (`.native.js`, `.ios.js`, `.android.js`) to be incorrectly included in web builds. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message. To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
|
Warning: Type of PR label mismatch To merge this PR, it requires exactly 1 label indicating the type of PR. Other labels are optional and not being checked here.
Read more about Type labels in Gutenberg. Don't worry if you don't have the required permissions to add labels; the PR reviewer should be able to help with the task. |
|
Size Change: 0 B Total Size: 3 MB ℹ️ View Unchanged
|
|
Flaky tests detected in 0482efe. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/21549585758
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Given the use-case described in #75113, I wonder if it might be better to use the cwd option to set the packageDir, so that the glob pattern doesn't include the full absolute path that trips this dot behavior.
Something like...
const srcFiles = await glob(
`src/**/*.${ SOURCE_EXTENSIONS }`,
{
ignore: IGNORE_PATTERNS,
cwd: packageDir,
},
);(We may not even need normalizePath if we make the change, since it's only needed to address a requirement of fast-glob patterns)
I admit to not being aware of this default dot file behavior in fast-glob, but I could see some value if it mitigates a risk of someone's internal files (sensitive configuration, etc.) from being accidentally included in the built / published npm artifacts.
Summary
dot: trueto fast-glob calls intranspilePackageProblem
When the repository path contains a dot-prefixed directory (e.g.,
.worktrees/),fast-glob's ignore patterns fail to match, causing
.native.jsfiles to beincorrectly included in web builds.
Fixes #75113
Test Plan
.worktrees/directorynpm run build🤖 Generated with Claude Code