Build/Test Tools: Check file types in the build directory. - #13706
adimoldovan wants to merge 2 commits into
Conversation
Adds a `verify:file-types` task to `verify:build`. It checks that CSS directories in `build/` hold only CSS files, JS directories hold only JS files, and no CSS or JS file sits elsewhere in `wp-admin/` or `wp-includes/`. The build copies files from npm packages and Gutenberg. Git does not track them, so a check of tracked files cannot see them. See #65279.
Test using WordPress PlaygroundThe 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
For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation. |
…ional. #65278 and #65279 will decide where these files belong. See #65279.
|
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 Core Committers: Use this line as a base for the props when committing in SVN: To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
Check the final production build for misplaced CSS and JavaScript files and unexpected file types in their directories. Run the check alongside the existing build verification tasks. Allow known bundled assets and mark the generated PHP exceptions as provisional while their placement remains under discussion. Developed in: #13706 Props adrianmoldovanwp. See #65279. git-svn-id: https://develop.svn.wordpress.org/trunk@63917 602fd350-edb4-49c9-b593-d223f7449a82
Check the final production build for misplaced CSS and JavaScript files and unexpected file types in their directories. Run the check alongside the existing build verification tasks. Allow known bundled assets and mark the generated PHP exceptions as provisional while their placement remains under discussion. Developed in: WordPress/wordpress-develop#13706 Props adrianmoldovanwp. See #65279. Built from https://develop.svn.wordpress.org/trunk@63917 git-svn-id: http://core.svn.wordpress.org/trunk@63086 1a063a9b-81f0-0310-95a4-ce76da25c4cd
|
Reopening after the revert in https://core.trac.wordpress.org/changeset/63918. Next step: settle the file-placement exceptions and upstream formatting approach before moving these forward. Discussion: https://wordpress.slack.com/archives/C08D0Q6BHNY/p1790267518339219 |
Adds a
verify:file-typesGrunt task. It checks that the CSS and JS files inbuild/sit in the directories meant for them. It follows up PR #13684.The two checks answer different questions:
src/build/after a production buildnpm run buildrunsNeither PR depends on the other.
How it works
The task runs in
verify:build, next toverify:old-filesandverify:source-maps. So it runs at the end of everynpm run build, which CI already runs inreusable-test-core-build-process.ymlbefore it zipsbuild/. It needs no new workflow. It does not run innpm run build:dev.It flags three cases under
build/wp-admin/andbuild/wp-includes/:css/directoryjs/directoryAn allow-list of 12 patterns covers the known exceptions. I measured it against a full production build (
npm ci,npm run gutenberg:download,npm run build, 5,016 files). It covers all 99 exceptions insidecss/andjs/directories, and all 640 CSS and JS files outside them. Those 640 are all inwp-includes/blocks/andwp-includes/build/.Testing instructions
The build passes. To see the task fail, add misplaced files and run it again:
It reports all three files. Clean up:
Trac ticket: https://core.trac.wordpress.org/ticket/65279
Use of AI Tools
AI assistance: Yes
Tool(s): Claude Code
Model(s): Claude Opus 5.5
Used for: Drafted the task, measured the allow-list against a real build, and ran code reviews. I reviewed the result.
This Pull Request is for code review only. Please keep all other discussion in the Trac ticket. Do not merge this Pull Request. See GitHub Pull Requests for Code Review in the Core Handbook for more details.