Supporting WP-CLI, an Essential Developer Tool for WordPress

Supporting WP-CLI, an Essential Developer Tool for WordPress

For the third year in a row, WP Engine is a proud co-sponsor of the WP-CLI Project, an initiative led by a small team of developers who dutifully maintain the command-line interface that’s beloved by so many WordPress users around the globe. 

Since its launch more than a decade ago, WP-CLI has become the go-to CLI tool for WordPress, as it offers an easy, straightforward way to do everything from install and set up websites to plugin maintenance, multisite configuration, and much more, all without using a web browser.

WP-CLI became an official WordPress CLI tool in 2016, and it’s now so widely used, code paths within WordPress Core itself have changed to better align with the requirements of WP-CLI.

Given the importance of this tool, we’re enthusiastic supporters, and we recently sat down with Alain Schlesser, who maintains the WP-CLI project, to find out more about recent WP-CLI developments and what users might expect to see on the horizon. 

It’s been more than a year since we last sat down to chat—what have been the major developments for WP-CLI since then? 

I’d say the most important “development” for WP-CLI would be the overall global impact that the current pandemic has had. From cancelled contributor days to developers being forced to focus on paid work and even sponsorships and stipends becoming rarer, there has been a definite drop in contributors helping keep WP-CLI in shape.

Together with an increase in both the development velocity and the willingness to add breaking changes from WordPress Core, it has been troublesome lately to just keep WP-CLI compatible with the latest and greatest WordPress version.

At the time of this writing, we’re finalizing a new WP-CLI release v2.5.0 that contains numerous compatibility fixes for both PHP and MySQL. But this compatibility work took up most of the development effort from the last release to this one, unfortunately, so I’m afraid we don’t have many new features to boast about this time.

If you’d like to contribute to or sponsor WP-CLI visit here.

Are there any new commands you’d like to highlight? New ways you’re seeing WP-CLI used to make life easier for developers? 

The most important change for most people will be that WP-CLI has added commands to manage plugin and theme auto-updates. You can check their state on a plugin or theme level, and enable or disable them.

The status command for these works in such a way that you can filter the list for further processing, like getting all the names of the plugins where auto-updates are currently disabled.

The only other command that was newly added is the wp i18n make-mo command, which lets you turn a .po translation file into its binary counterpart.

How is WP-CLI used with Gutenberg today and what do you think the future might hold?

WP-CLI already plays an important part in supporting the Gutenberg development. On one hand, we have the series of i18n commands that are used to create the translation files for Gutenberg. The WP-CLI tooling for the JavaScript versions of these files is being shaped in parallel with the build requirements, and the two projects collaborate to define a clean and reusable way for JavaScript translations to be extracted and managed.

On the other hand, we have a way in WP-CLI to scaffold a basic Gutenberg block to get started with block development. It is very basic right now, focusing on a more “conservative” use of JavaScript, but once all of the tooling around block creation has solidified, we hope to be able to provide the canonical way to kickstart any block development in the future.

There are plans to go even further, like letting you list blocks from a given site or manipulating blocks for a post. However, most of this work is still blocked by the fact that the WordPress server right now has no complete knowledge of the registered blocks, as a lot of the logic is still executed client-side only. This is being worked on, but in the meantime, it is not possible to reliably control blocks from a server-side tool like WP-CLI.

What else might WP-CLI users look forward to seeing soon? Anything on the horizon you can share with us? 

I’m still doing a lot of work on rethinking the scaffolding command, and I’m hopeful that once v2.5.0 is out and we’re in a calmer state regarding WordPress Core compatibility, I’ll be able to make more rapid progress and share an initial working version soon.

The basic idea is that the scaffolding command should not be a simple template renderer as it is now, but rather a code generation tool that understands the code it manipulates and therefore can not only produce more flexible new projects and files but also hook into existing code to extend it in meaningful ways.

I’d like for the WP-CLI scaffold command to serve the same role that the artisan make commands serve for Laravel. They provide quick ways of adding most of what makes up a Laravel project, and by doing so, they establish sane conventions and encode best practices in a frictionless way.

In the past, you’ve expressed interest in more people getting involved with the WP-CLI project. What sort of needs are you facing right now? How can people get involved?

Absolutely! I’m currently very busy fixing bugs and compatibility issues, so I’d love for more people to look into creating new commands or extending existing ones, so we can have more interesting releases again. It seems more difficult in the current climate to afford spending time on free contributions, I’m fully aware of that. So if any developers are even remotely interested in any work on WP-CLI, please do contact me on Slack in the #cli channel, and let’s discuss. I’ll do my best to make sure the time you actually can invest will be used efficiently and will have an actual impact!

If you’re not interested in developing, you might want to help other WP-CLI users find the best resources available. We now have an official “awesome” list for WP-CLI: https://github.com/schlessera/awesome-wp-cli. I’d love for advanced WP-CLI users to share their best resources on there so that we have a nice discovery mechanism that helps people get up and running quickly.

For other ways of getting involved, I can point you to the contributing overview here: https://make.wordpress.org/cli/2018/07/14/contributing-to-wp-cli/.

Contact WP Engine today to find out more about additional WordPress development tools like Local and Genesis, which let you build and launch great-looking websites faster.  



Source link

X
X