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

Documentation request: how to compress to a file within plugin folder #90

Closed helgatheviking closed 5 months ago

helgatheviking commented 5 months ago

I keep trying wp dist-archive . deploy/ --create-target-dir and variations therefore but I can't seem to get the zip archive to get compressed to mycoolplugin/deploy/mycoolplugin-1.0.0.zip it ends up generated as deploy.zip instead. I assume this is a path mistake I'm making but it would be nice to see an example in the docu.

BrianHenryIE commented 5 months ago

Try:

wp dist-archive . ./deploy --plugin-dirname=mycoolplugin --create-target-dir
helgatheviking commented 5 months ago

Hmm... that's throwing an error

Error: Parameter errors:
 unknown --plugin-dirname parameter
Script wp dist-archive . ./deploy --plugin-dirname=anonymize-woocommerce-customers --create-target-dir handling the zip event returned with error code 1
BrianHenryIE commented 5 months ago

Ah, there hasn’t been a tagged release since before that was added. If you’re installing with Composer, use dev-main as the version, if you’re using the WP CLI package installer, use wp package install wp-cli/dist-archive-command:dev-main.

https://github.com/wp-cli/dist-archive-command/releases

ernilambar commented 5 months ago

@helgatheviking If you run the command staying at the plugin path then that parameter is not needed. Try following:

wp dist-archive . ./deploy --create-target-dir
helgatheviking commented 5 months ago

Thank you @BrianHenryIE and @ernilambar !

danielbachhuber commented 5 months ago

Ah, there hasn’t been a tagged release since before that was added.

I just tagged 3.0.0: https://github.com/wp-cli/dist-archive-command/releases/tag/v3.0.0

BrianHenryIE commented 5 months ago

Great. That also helps in: https://github.com/10up/action-wordpress-plugin-deploy/issues/139#issuecomment-2035180163