While building the Post Format Block, I’ve set up a nice toolchain that I think every plugin developer would benefit from using. WordPress Plugin Development in 2021 has a lot more tools available than when I wrote my first plugin a dozen years ago. There are three that I found to be hugely life-improving while building this plugin.
In her recent WordCamp US talk, Helen Hou-Sandí had a surprise at the end which is that her live demo wasn’t a local development environment, it was all running on Github Codespaces. Per branch and sharable development environments?😍
To set up codespaces for my project, I first looked at Helen’s project. There are three main files: one to tell vscode how to access the project(
devcontainer.json ), one to say what the docker containers should look like (
docker-compose.yml ) and one to get the specifics of my environment setup (
setup.sh ). I was able to copy both of the first two and make minor updates, with the only changes being paths since my project is a plugin not a theme and it has a different name. For the setup.sh, I updated the variables at the top, but I also added a few wp cli commands. Overall, this process took less than an hour and that is largely thanks to the work of Helen that she has open-sourced (Thanks GPL!)
My next step of playing with codespaces is going to be to figure out how to us VIM with it, but I think it will be a permanent part of my WordPress Plugin development tool chest.
WordPress.org Plugin Deploy GitHub action
Unpopular Opinion but I like SVN. However, I like not having to do work more than I like SVN and with the WordPress.org Plugin Deploy GitHub Action from 10up, I don’t have to worry about updating the WordPress.org repository. Setup was quick: I copied code from Mark Jaquith’s newest plugin (Thanks GPL!), set up some secrets, and I was ready to go. Super happy to have tools like this being built and shared.
wp-scripts: The WordPress Plugin Development Secret Weapon
I’ve found wp-scripts to be valuable outside of block development. It can be used for any plugin where you want a build process. Using it at work gave us a build process for a new plugin in a matter of minutes. Heck, I’ve even used it on non-WordPress projects, especially when I want a no config way of enforcing the WordPress coding standards that I already know and use. I view it as being as close to a must-use as exists right now.
Automating your development workflow is something that will help save you time and can improve the quality of your code by allowing you to focus more on the things that matter and less on repeatable tasks. These three tools do just that.