The audit of the bones CLI had two halves. The first, 2.0.10, was about safety: a deploy that could delete the folder above your plugin. This is the second, and it is about the plumbing: the things bones quietly got wrong on an ordinary day.
Run it from anywhere
bones used to work only from the plugin's own folder. Run php my-plugin/bones from the folder above and it could not find the plugin's namespace file, and stopped with a TypeError. Now it moves into the plugin before doing anything, and custom commands find WordPress from wherever you are. A relative deploy path still means the folder you typed it in, and a plugin symlinked into wp-content/plugins keeps working.
A rename that touches only what it must
rename rewrote every file of the plugin, changed or not. On the Internationalization boilerplate that was 187 files written, 99 of them identical to what they had been, and something worse: the compiled .mo catalogues came out corrupted. A .mo is a binary file with an offset table, and replacing wp-kirk with a longer id shifts every string after it while the table stays put. Now only the files that change are written, and binary files are left alone.
The same fix closes a nastier one. rename --update runs after every composer install, and it went through the whole rename again. In a renamed plugin with an index.php in its root, it took that file for the main file of a pre-1.5 plugin and moved it over your real one. It now renames vendor/, what Composer has just installed, and nothing else.
An update that can fail safely
php bones update deleted vendor/wpbones/wpbones first, then ran composer update. If Composer failed, with no network or a conflict, the plugin was left with no framework at all. Composer replaces the package by itself, so nothing is deleted first any more, and the command runs composer update wpbones/wpbones --with-dependencies: the framework and what it needs, which is what "Update the Framework" in the help always promised.
A format check that checks
The format:check script that migrate:to-v2 writes called wp-scripts format --check. But wp-scripts format drops --check and always writes, so the "check" reformatted the plugin, compiled bundles included, and reported success. It is a real prettier --check now, with a .prettierignore that keeps format away from public/ too. The boilerplates carry the new script, and their sources pass it.
Widgets with their own identity
make:widget gave every widget of a plugin the same id_base, and WordPress stores a widget's settings under its id_base, so a second widget shared the first one's settings. The description sat under a misspelled key. Each widget now gets its id, name and description from its class name.
Upgrading
composer update wpbones/wpbones. One behaviour to know: php bones update now updates the framework and its dependencies, not every package of your plugin; for that, run composer update. If your plugin was migrated before 2.1.0, its format:check still points at wp-scripts format --check, and the package.json page has the replacement. The 14 boilerplates and their Playground demos are already on 2.1.0, and the full notes are on GitHub.
WP Bones is free and open source (LGPL-3.0), runs on PHP 8.1+, and installs with Composer.
Website: https://wpbones.com
Docs: https://wpbones.com/docs
Published via ZyVOP — Write once in Markdown, auto-backup to GitHub, and syndicate to Dev.to, Medium & Hashnode in 1 click.

Top comments (0)