Skip to content

Conversation

@aduth
Copy link
Member

@aduth aduth commented Nov 3, 2025

What?

Updates the build script to ignore package folders which don't contain a package.json.

Why?

When changing from a branch which introduces a new package to trunk, the package folder is not removed from the local filesystem, only the files within it. This causes npm run build to fail because it detects the folder, but cannot read the package.json:

❌ Build failed: Error: ENOENT: no such file or directory, open '/gutenberg/packages/foo/package.json'

How?

Updates the package logic to only detect folders which contain a package.json file.

Testing Instructions

Verify that adding an empty folder in packages/ does not cause the build to fail as it does on trunk:

mkdir packages/foo
npm run build

Observe that the number of packages built is the same between trunk and this branch.

@aduth aduth requested a review from youknowriad November 3, 2025 19:25
@aduth aduth added the [Type] Build Tooling Issues or PRs related to build tooling label Nov 3, 2025
Copy link
Contributor

@youknowriad youknowriad left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It did happen to me several times. Thanks for fixing it

@github-actions
Copy link

github-actions bot commented Nov 3, 2025

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 props-bot label.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: aduth <[email protected]>
Co-authored-by: youknowriad <[email protected]>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@aduth aduth merged commit 63e9a59 into trunk Nov 3, 2025
47 of 49 checks passed
@aduth aduth deleted the update/build-ignore-empty-folders branch November 3, 2025 20:38
@github-actions github-actions bot added this to the Gutenberg 22.1 milestone Nov 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Type] Build Tooling Issues or PRs related to build tooling

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants