Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Local Environment: Add support for reading wp-env configuration #230

Closed
sejas opened this issue May 2, 2023 · 7 comments
Closed

Local Environment: Add support for reading wp-env configuration #230

sejas opened this issue May 2, 2023 · 7 comments
Assignees

Comments

@sejas
Copy link
Collaborator

sejas commented May 2, 2023

It would be great to increase the compatibility with wp-env.
For this reason, we should check the current format https://developer.wordpress.org/block-editor/reference-guides/packages/packages-env/#examples and override the wp-now default config values with those in .wp-env.json.

Done is:

  • We override the WordPress version, PHP version and other config parameters. Not all of them, only those we are currently accepting as CLI parameters.
  • The CLI parameter has more priority than the config file.
@danielbachhuber danielbachhuber changed the title Local Environment: Read wp-env configuration. Local Environment: Add support for reading wp-env configuration May 2, 2023
@kozer
Copy link
Contributor

kozer commented May 4, 2023

Hey @sejas ! Can you assign me this one? Thanks!

@sejas sejas assigned sejas and kozer and unassigned sejas May 4, 2023
@sejas
Copy link
Collaborator Author

sejas commented May 4, 2023

@kozer, Thanks for taking this issue 🙏

@danielbachhuber
Copy link
Member

danielbachhuber commented May 4, 2023

I think it'd be good to have some tests around this too. Tests will prevent accidental breakage and save us time from testing various permutations of the config file.

@kozer
Copy link
Contributor

kozer commented May 5, 2023

Hello @sejas ,
I have some questions for you:

  • Where should I look for the .wp-env.json file? To where the user executes the code, or into the folder the user provides via path?
  • Should I take into consideration ..wp-env.override.json as well?
  • Where typically a .wp-env.json file exists?
  • We need to take into consideration only php, path, and port as parameters to override for now?

@sejas
Copy link
Collaborator Author

sejas commented May 5, 2023

@kozer,

Where should I look for the .wp-env.json file? To where the user executes the code, or into the folder the user provides via path?
Where typically a .wp-env.json file exists?

.wp-env.json usually exists in the plugin/theme project root folder. You need to use the given --path=, which is the current directory by default.

Should I take into consideration .wp-env.override.json as well?

Yes, I think it's easy to implement. If this override file .wp-env.override.json exists, then read it, if it doesn't exist, try to read .wp-env.json`. And the arguments passed inline should have higher priority.

We need to take into consideration only php, path, and port as parameters to override for now?

Yes, php, wp versions and port.
I think path is not supported by .wp-env.json

In the future, we could support plugins and mappings.

@adamziel
Copy link
Collaborator

adamziel commented May 5, 2023

Be sure to read about Blueprints (merged in #211 and improved in #214 – documentation coming soon!) – you may be able to rewrite a good chunk of .wp-env.json as a Blueprint, and then we'll see if it makes sense to add support for anything that cannot yet be expressed as one.

@danielbachhuber
Copy link
Member

🚢

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants