Build: Clean top-level build/ directory during clean:packages#75961
Build: Clean top-level build/ directory during clean:packages#75961
build/ directory during clean:packages#75961Conversation
|
Size Change: 0 B Total Size: 6.84 MB ℹ️ View Unchanged
|
|
Flaky tests detected in 3f8577f. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/22443956612
|
|
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. |
|
Thank you, @mirka! |
| "build:plugin-zip": "bash ./bin/build-plugin-zip.sh", | ||
| "clean:package-types": "tsc --build --clean && rimraf --glob \"./packages/*/build-types\"", | ||
| "clean:packages": "rimraf --glob \"./packages/*/{build,build-module,build-wp,build-style}\"", | ||
| "clean:packages": "rimraf --glob \"./packages/*/{build,build-module,build-wp,build-style}\" \"./build\"", |
There was a problem hiding this comment.
Should this be just "clean" then?
Closes #75933
What?
Adds
./buildto theclean:packagesrimraf targets so the top-levelbuild/directory is cleaned alongside the per-package intermediate build directories.Why?
The
clean:packagesscript only removedpackages/*/build-style/and similar intermediate directories, but not the top-levelbuild/directory where the final bundled artifacts live (e.g.build/styles/theme/,build/scripts/*/). The bundling step inwp-buildcopies frompackages/*/build-style/intobuild/styles/*/but never cleans the destination first.This means when a source file is deleted — like
packages/theme/src/style.scssin #75879 — the stale output inbuild/styles/theme/persists from the previous build, breaking the build without manualgit cleanintervention.Since
build/is gitignored and fully regenerated by the build pipeline (build-vendors→wp-build→build-blocks-manifest), it's safe to clean at the start.How?
One-line change to the
clean:packagesscript inpackage.jsonto also rimraf./build.Testing Instructions
mkdir -p build/fake && echo "stale" > build/fake/stale.cssnpm run build.build/fake/no longer exists.