wp-cli-dev icon indicating copy to clipboard operation
wp-cli-dev copied to clipboard

Prefetch `WP_VERSION=latest` when running `composer install`

Open danielbachhuber opened this issue 1 year ago • 5 comments

On hack days with a slow internet connection, the initial run of composer behat can be quite slow as WP-CLI fetches a copy of WordPress across the network. This can cause the user to think something is broken with their test suite.

Let's instead download WP_VERSION=latest during composer install and put it in the appropriate cache directory. This will provide more visibility into what's going on.

danielbachhuber avatar Nov 16 '23 13:11 danielbachhuber

@danielbachhuber That will make the Composer run seem unnecessarily slow, and there might be scenarios where people need to run composer install but have no use for the Behat tests.

How about instead just providing meaningful progression feedback while Behat is downloading WP?

schlessera avatar Nov 16 '23 14:11 schlessera

@schlessera Or a third option: a composer cache-wordpress or similar command that a user can run during the setup process.

danielbachhuber avatar Nov 16 '23 14:11 danielbachhuber

@danielbachhuber I'm not sure how this third option would solve the actual issue, it just seems to add complexity, isn't it?

schlessera avatar Nov 16 '23 14:11 schlessera

@schlessera The actual issue is that the downloading of WordPress is an opaque part of the setup process. The third option solves it by making it an explicit (albeit not required) step.

I don't feel strongly about it, though. More verbosity works for me too.

danielbachhuber avatar Nov 16 '23 14:11 danielbachhuber

@danielbachhuber I think the current timing and behavior is already correct (only downloading when needed, caching as possible, not requiring the user to know about the details). But, definitely, it needs more feedback. What could work is to prepend it onto composer behat instead, that would not change the behavior or the requirements, but allows for adding the feedback without messing with the Behat STDOUT/STDERR.

schlessera avatar Nov 16 '23 14:11 schlessera