wordup-dev / wordup-cli

Wordup is a fully integrated development platform for WordPress. Develop plugins and themes locally. Preview in the cloud. Automatic updates in WP.
GNU General Public License v3.0
118 stars 16 forks source link

Specify your own volumes #24

Closed JuicyLung91 closed 4 years ago

JuicyLung91 commented 4 years ago

Nice project!

How about specify your own volumes your want to mount. This would improve my git setup and my IDE workflow.

shry commented 4 years ago

You want to mount an existing docker volume of an already running WordPress container?

JuicyLung91 commented 4 years ago

I would like to have the abillity to mount specific directories inside the wordpress container. Let me explain this in two sections:

First the git workflow: Right now if you develop a plugin the src directory is mounted with the wp-content/plugins/plugin-name directory or wp-content/themes/theme-name for theme development.But when you develop a plugin and a theme the whole src directory is mounted with the wp-content directory. Which ends up in a messy src directory.

In the src directory there appear severel directories I don´t need in my git repo.

├── languages
    ├── most of the files I dont need in my git
├── plugin
    ├── my plugin i am developing
    ├── some other plugin I dont need in my git
    └── some other plugin I dont need in my git
├── theme
    ├── my theme am developing
    ├── some other theme I dont need in my git
    └── some other theme I dont need in my git
├── upgrade
├── uploads
    ├── maybe I need this but not for the initial local development

This ends up in a weird git ignore file. Where I have to exclude a whole directory and then write an exception for single directories.

src/plugins/*
src/uploads
src/upgrade
src/languages
!src/plugins/rb-products
src/themes/*
!src/themes/theme

Maybe as an enhancment it would be a good solution to create your own mounts in the config file. Like this:

wpInstall:
  mounts: 
    - ./src/plugin-name/:/var/www/html/wp-content/plugins/plugin-name # Plugin development
    - ./src/theme-name/:/var/www/html/wp-content/themes/theme-name# Theme development

Second the IDE workflow: Right now my VSC doesn´t recognize the wordpress functions like the_title(). Because the wordpress data is not in my workspace. My IDE hilights the wordpress functions as errors.

I ended up to load the whole initial wordpress data into my root directory of the current workspace and then set this directory to gitignore. Now I don´t know if this is recommanded or if there is a better solution. But it would be a solution for me to mount the whole wordpress project inside a directory on the root level and the set this ignore this directory in the gitignore.

wpInstall:
  mounts: 
     - ./wp-app:/var/www/html # Full wordpress project
shry commented 4 years ago

First of all, thank you for your feedback and detailed answer.

First the git workflow: ...

I understand that your approach of developing a theme and a plugin in one wordup project is difficult and not very "clean". tbh i never thought that there would be a use case for that. Because i thought (and please correct me if i'm wrong ;)): If you are developing a theme, you can code the same stuff you could do in a plugin. Thats why i personally separate all my plugin or theme developing in different projects.

Second the IDE workflow: ...

I understand the problem with your IDE, for now i don't see an easy solution for that. I'm using also VSCode, and in that editor you can also code directly in the container with an extension, so that could be an option. See: https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers

JuicyLung91 commented 4 years ago

If you are developing a theme, you can code the same stuff you could do in a plugin. Thats why i personally separate all my plugin or theme developing in different projects.

Well in 80% of the cases this is true, but there are some specific cases where you have to develop both. In this cases you may create this weird gitignore but a custom volume would also help.

I'm using also VSCode, and in that editor you can also code directly in the container with an extension, so that could be an option. See: https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers

I will check this out :) thanks.

One last advantage for a custom volume would be a custom php.ini and a custom .htaccess or even some changes in the wp-config, for example if you do a multidomain setup (but this is probably a whole new thing).

You can close this if you want, it was just an idea I had.