Repository navigation
feat(cli): build to a directory and add a quiet mode - #21
Merged
Merged
Conversation
toDirectory() runs the same steps and verification as zip() and writes a folder, for rsync or SVN deploys, test sites, or inspecting what ships. The target is replaced only if it is empty or an earlier build of the same project; the project itself or a folder above it is refused, with paths resolved and compared without case. quiet() prints only warnings. Packaging moves into ZipPackager and DirectoryPackager. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Two additions to the packager.
CLI:
wptoolkit-build package --dir=PATHand--quiet. Config:"quiet": true.Why
zip()was the only way to finish a build, and staging is deleted afterwards. Deploying by rsync or SVN, mounting a built plugin in a test site, or inspecting exactly what ships (after all steps have run, whichdryRun()does not do) needed a zip and an unzip. Our own E2E fixture did exactly that; it now usestoDirectory().zip()always prints its summary, and the only control waswithOutput()with an empty closure, which also hides warnings. A consumer'sbuild.phpechoed$report->summary()again and printed it twice; the guide now says the summary is printed for you.toDirectory()safetyThe target folder is replaced, so it is checked before any command runs, and again before writing:
.,..) and compared without letter case and throughrealpath(), because on Windows and macOS the project spelled in another case is the same folder, and its own main file would otherwise make it look like an earlier build;Other changes
BuildintoZipPackagerandDirectoryPackager, sharingStagedFiles. Zip output is byte-for-byte unchanged (the reproducibility test still passes).BuildReportgainsdirectory; for a directory buildzipandsha256are empty andfilesare relative to the folder.quiet()wins oververbose(); warnings are still printed and still on the report.Tests
Written first. Directory output equals the zip's file list; commands and verification run; a previous build is replaced, not merged; empty target accepted; a folder holding other files is left untouched; the project, its parent,
dist/..,.., an upper-cased project path and a source folder are all refused with the files intact; working tree unchanged; quiet prints nothing but warnings and still returns the report.🤖 Generated with Claude Code