Skip to content

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

Closed

Description

@sejas

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.

Activity

  1. changed the title [-]Local Environment: Read `wp-env` configuration.[/-] [+]Local Environment: Add support for reading `wp-env` configuration[/+] on May 2, 2023
  2. kozer commented on May 4, 2023

    @kozer
    Contributor

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

  3. assigned and unassigned on May 4, 2023
  4. sejas commented on May 4, 2023

    @sejas
    CollaboratorAuthor

    @kozer, Thanks for taking this issue 🙏

  5. danielbachhuber commented on May 4, 2023

    @danielbachhuber
    Member

    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.

  6. kozer commented on May 5, 2023

    @kozer
    Contributor

    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?
  7. sejas commented on May 5, 2023

    @sejas
    CollaboratorAuthor

    @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.

  8. adamziel commented on May 5, 2023

    @adamziel
    Collaborator

    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.

  9. danielbachhuber commented on May 17, 2023

    @danielbachhuber
    Member

    🚢

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions