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
48 stars 24 forks source link

Refactor into `get_file_paths_and_names()` function #81

Closed BrianHenryIE closed 10 months ago

BrianHenryIE commented 1 year ago

Adds a function/moves the logic for determining the source directory, the output directory, the output filename, and the plugin directory name the archive will extract to. Which required moving the logic to determine the plugin version into its own function too (less attention paid here).

No change in behavior indicated through the tests. This will hopefully address #76 but I do not have a Windows setup to test it on. See the added regex on line 205 which now accounts for Windows absolute paths.

Also an opportunity for some code review as suggested yesterday.

BrianHenryIE commented 11 months ago

@danielbachhuber Yes, please. I've further changes planned – in particular to make things faster. Currently, even when /vendor is in the .distignore, it's comparing every file inside vendor against the rules!

swissspidy commented 11 months ago

Functionality-wise it looks good to me so far 👍 Just merged the latest changes so that tests pass again, which is a good sign too.