playground-tools icon indicating copy to clipboard operation
playground-tools copied to clipboard

Local Environment: Auto-apply plugin or theme Blueprint when initializing

Open danielbachhuber opened this issue 1 year ago • 5 comments

In certain cases, a plugin or theme may want to have its local environment pre-configured to a default state. It would be cool if our wp-now.json file supported a blueprint attribute, so that the blueprint is auto-applied when running wp-now start for the first time.

danielbachhuber avatar Apr 28 '23 13:04 danielbachhuber

Conceptually, is wp-now.json any different from a Blueprint? If not, then we could join forces here to make Blueprints better.

Blueprints already support setting preferred PHP/WP versions and in the future they'll also support:

  • Setting min/max PHP/WP versions
  • Specifying custom WordPress core (via a path or a url)
  • Specifying the required PHP extensions
  • ...probably many other things that will also be useful in context of wp-now.json

What would be an example of a setting that's useful in wp-now.json but not in a Blueprint?

adamziel avatar May 05 '23 14:05 adamziel

Conceptually, is wp-now.json any different from a Blueprint? If not, then we could join forces here to make Blueprints better.

@adamziel Maybe not. What filename are Blueprints using? Could we adopt the "Blueprint format" for wp-now.json?

danielbachhuber avatar May 08 '23 22:05 danielbachhuber

Could we adopt the "Blueprint format" for wp-now.json?

I think so – it would also inform the evolution of the Blueprint format.

What filename are Blueprints using?

Blueprint isn't using any filename at the moment. It's just a JSON object you can pass to startPlaygroundNode() or apply it manually as follows:

https://github.com/WordPress/wordpress-playground/blob/2b01f8dbd63e6e54db8e579f5687fe70e8bd7237/packages/playground/node/src/index.ts#L23-L55

adamziel avatar May 09 '23 22:05 adamziel

CC @sejas on that startPlaygroundNode() function referenced above – perhaps it could be reused by or moved into wp-now.

adamziel avatar May 09 '23 22:05 adamziel

@adamziel it would be great if WordPress Playground for VS Code could automatically pick up a blueprint from the current repository.

bgrgicak avatar Jan 09 '24 09:01 bgrgicak