wp-cli / dist-archive-command

Create a distribution .zip or .tar.gz based on a plugin or theme's .distignore file
https://developer.wordpress.org/cli/commands/dist-archive/
MIT License
47 stars 23 forks source link

How to run composer install before make the dist archive? #97

Closed davidperezgar closed 2 months ago

davidperezgar commented 2 months ago

Hello! I love this command and I'm using a lot. I'd need run composer before makes the dist archive. How could approach that?

swissspidy commented 2 months ago

Since it's just a fancy way of making a zip file, there isn't really any special way for doing that.

cd my-project
composer install
wp dist-archive .
ernilambar commented 2 months ago

This will also include the package which is not needed in production. So to avoid this, you can use separate folder as base folder to archive.

Example: https://pascalbirchler.com/phpstan-wordpress/

davidperezgar commented 2 months ago

Obviously I was thinking in the same command

swissspidy commented 2 months ago

WP-CLI is all about composability. If you want to run composer before zipping, then run composer before dist-archive. Why doesn't that work for you?

ernilambar commented 2 months ago

I added dist archive as composer dev dependency. That is why.

davidperezgar commented 2 months ago

No problem, thanks. I concatenate the command, and it working fine.

composer update --no-dev --working-dir=wp-content/plugins/plugin && wp dist-archive wp-content/plugins/plugin ~/projects/ --filename-format={name}-{version}