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

Map Core to local file system #7

Open
iandunn opened this issue Aug 18, 2021 · 4 comments
Open

Map Core to local file system #7

iandunn opened this issue Aug 18, 2021 · 4 comments
Labels
enhancement New feature or request
Milestone

Comments

@iandunn
Copy link
Member

iandunn commented Aug 18, 2021

Not sure if wp-env can do this, but it'd be helpful to have the WordPress folder inside the container mapped to the local filesystem. A few use cases

  • IDEs needing to see it for autocompletion, etc
  • setting breakpoints for remote debugging
  • var_dump() in a core file for quick debugging
@iandunn iandunn added the enhancement New feature or request label Aug 18, 2021
@iandunn iandunn added this to the 1st repo milestone Aug 18, 2021
@coreymckrill
Copy link
Contributor

This can be done in the .wp-env.json file via something like this:

{
    "core": "./wordpress"
}

It has some side effects that are annoying, like having a modified .htaccess file constantly showing up in your WP directory that makes the working directory dirty.

I generally save this for the .wp-env.override.json file, so I can just turn it on when I need to debug something or check out a different version of WP, and then turn it off again when I don't want to deal with it.

@iandunn
Copy link
Member Author

iandunn commented Aug 18, 2021

ah, thanks. that just created an empty wordpress dir for me, though 🤔
I tried "/" and "./" instead of core too, but no joy. maybe core is a special value that maps to whatever is in the other core value in the env file?

I could add ~/.wp-env/aaa3d4d50a4a7916b74d7cff0c3cf5fb/WordPress/ as an external source in PHPStorm, but I'm guessing that ID will change when I destroy the container, and maybe more frequently. It also contains all the plugins and everything else.

i can try again later, but don't wanna go any further down that rabbit hole today

@coreymckrill
Copy link
Contributor

that just created an empty wordpress dir for me, though

Well, that was just an example. It has to point to a directory that already has WordPress in it. More here.

@iandunn
Copy link
Member Author

iandunn commented Aug 19, 2021

Ah, I was thinking it was mapping the instance of WP already installed inside the container to the local system, but it's the other way around. It's also the top-level core attribute, rather than one inside mappings. I downloaded WP to a local folder, and now that works, thanks!

I'll see what issues I run into, like the htaccess one you mentioned. I imagine I'd want it mapped all the time, for IDE hints at the very least. It might be possible to gitignore the htaccess file, but if others wouldn't want that, then a wp-env.override.json template might serve as documentation and minimize the time setting up new sites.

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

No branches or pull requests

2 participants