I’m working on a custom theme on a bedrock setup. During development, plugins such as Debug bar, Query monitor, etc are priceless so I include them in composer.json. However, as you might guess, after cap production deploy, they are also installed on the prod server, which I don’t want.
The question is, how do you manage plugins for development on dev and prod machines?
One way is to install the dev plugins locally manually, not adding them to composer.json so they won’t get installed on production server. The problem with this approach is that I also use capistrano-wpcli for database pull/push. What happens is that WordPress on production server shows warnings that plugins were deactivated because they are not present in plugins directory, which is true.
For development dependencies, there’s an easy solution. Composer has require-dev which works just like require. Capistrano runs composer install --no-dev which skips those. See https://getcomposer.org/doc/04-schema.md#require-dev
It’s a slight abuse (and still arguable) of their intention of the feature but in this case I’m perfectly okay with that.
@ben I apologize but I couldn’t find that topic before asking the question. That plugin looks neat. Conditional enabling or disabling of plugins is a part of the solution. Thanks for the link.
@swalkinshaw that’s exactly what I was looking for. Or at least partially. By adding dev plugins into require-dev, they won’t get installed on production servers but other developers will get them too. After that, they’ll be deactivated on prod based on Mark Jaquith’s plugin.
I’ve wrapped Mark Jaquith’s snippet into a plugin which can be used in a Bedrock-powered website to always enable/disable dev plugins. Here’s the repo: https://github.com/lamosty/bedrock-plugin-control