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

Difficulties zipping current directory with correct paths #34

Closed swissspidy closed 2 years ago

swissspidy commented 5 years ago

Besides #30 I found some other oddities when using wp dist-archive to build a ZIP of the current plugin in CI context (here's my current code: https://github.com/wearerequired/traduttore/pull/124)

Right now it doesn't seem to be possible to zip the current directory either using wp dist-archive "$(pwd)" build.zip or wp dist-archive . build.zip. Neither of which cases have a test case, FWIW.

I also noticed inconsistencies between wp dist-archive ./ build/test.zip --debug and wp dist-archive ./ build.zip --debug, where the latter uses an absolute path for the source directory but the former doesn't.

Even more interestingly, wp dist-archive ./ build.zip --debug returns a success message, but when executing the actual zip command that is shown when using --debug, it errors.

I shared my findings on Slack: https://wordpress.slack.com/archives/C02RP4T41/p1542835280388500

I'll try to find some time on Sunday or next week to write some tests for these scenarios and hopefully even come up with some fixes.

Related: https://github.com/wp-cli/wp-cli/issues/5007

BrianHenryIE commented 2 years ago

wp dist-archive . build.zip works for me and creates build.zip in the current directory.

wp dist-archive . ./scratch/build.zip fails even though the scratch folder exists:

Error: Target directory does not exist: ./scratch/build.zip

wp dist-archive . ./scratch/build.zip --create-target-dir succeeds but the file is not placed in the subdirectory of ., rather it's at ../scratch/build.zip