Skip to content

Build: copyBlockAssets: Use cpSync for proper recursive copy#10805

Closed
mcsf wants to merge 1 commit intoWordPress:trunkfrom
mcsf:fix/gutenberg-copy-block-assets
Closed

Build: copyBlockAssets: Use cpSync for proper recursive copy#10805
mcsf wants to merge 1 commit intoWordPress:trunkfrom
mcsf:fix/gutenberg-copy-block-assets

Conversation

@mcsf
Copy link
Contributor

@mcsf mcsf commented Jan 27, 2026

See https://core.trac.wordpress.org/ticket/64559

Issue first described in WordPress/gutenberg#74805 (comment)

Replace manual file iteration via fs.cpSync — which didn't support unexpected nested directories in block types' source dirs — with fs.cpSync.

Issue first described in WordPress/gutenberg#74805 (comment)

Replace manual file iteration via `fs.cpSync` — which didn't support
unexpected nested directories in block types' source dirs — with
`fs.cpSync`.
@github-actions
Copy link

github-actions bot commented Jan 27, 2026

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.

Core Committers: Use this line as a base for the props when committing in SVN:

Props mcsf, youknowriad.

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

@github-actions
Copy link

Test using WordPress Playground

The changes in this pull request can previewed and tested using a WordPress Playground instance.

WordPress Playground is an experimental project that creates a full WordPress instance entirely within the browser.

Some things to be aware of

  • The Plugin and Theme Directories cannot be accessed within Playground.
  • All changes will be lost when closing a tab with a Playground instance.
  • All changes will be lost when refreshing the page.
  • A fresh instance is created each time the link below is clicked.
  • Every time this pull request is updated, a new ZIP file containing all changes is created. If changes are not reflected in the Playground instance,
    it's possible that the most recent build failed, or has not completed. Check the list of workflow runs to be sure.

For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation.

Test this pull request with WordPress Playground.

@youknowriad
Copy link
Contributor

Replace manual file iteration via fs.cpSync — which didn't support unexpected nested directories in block types' source dirs — with fs.cpSync.

Do we want to support these random folders or only keep block types folders? AFAIK, this is the first time we do this right?

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.

I like the simplification of the code, regardless of whether we want to support additional random folders or not.

@mcsf
Copy link
Contributor Author

mcsf commented Jan 29, 2026

Do we want to support these random folders or only keep block types folders?

This is the choice I gave in WordPress/gutenberg#74805 (comment). My opinion is that it's not copyBlockAssets's job to have an opinion, and it certainly shouldn't fail. So:

  • copyBlockAssets should either copy or ignore (but not fail) folders
  • a discussion about conventions on dir structure, if desired, should happen in Gutenberg

AFAIK, this is the first time we do this right?

Yes and no. It's definitely not the first time we've added a directory under a block type:

$ find packages/block-library/src \
        -mindepth 2 -maxdepth 2 \
        -type d \
        -not -path '*/test' \
        -not -path '*/test/*'

packages/block-library/src/comments/edit
packages/block-library/src/navigation-link/link-ui
packages/block-library/src/navigation-link/shared
packages/block-library/src/file/utils
packages/block-library/src/navigation/utils
packages/block-library/src/navigation/edit
packages/block-library/src/template-part/edit
packages/block-library/src/social-link/icons
packages/block-library/src/list-item/hooks
packages/block-library/src/query/edit
packages/block-library/src/terms-query/edit
packages/block-library/src/cover/edit

But it is the only one ending up in the build artefacts:

$ find build/scripts/block-library \
        -mindepth 2 -maxdepth 2 \
        -type d

build/scripts/block-library/navigation-link/shared

@github-actions
Copy link

A commit was made that fixes the Trac ticket referenced in the description of this pull request.

SVN changeset: 61567
GitHub commit: dc62ecb

This PR will be closed, but please confirm the accuracy of this and reopen if there is more work to be done.

@github-actions github-actions bot closed this Jan 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants