dist-archive-command icon indicating copy to clipboard operation
dist-archive-command copied to clipboard

Correctly ignore distribution archive files

Open danielbachhuber opened this issue 9 years ago • 5 comments

Files like *.zip and *.tar.gz shouldn't be included in distribution builds.

From https://github.com/wp-cli/wp-cli/pull/3520 and https://github.com/wp-cli/scaffold-package-command/pull/66

danielbachhuber avatar Jan 05 '17 22:01 danielbachhuber

I wonder why this command uses a separate .distignore file to ignore files and it doesn't use the export-ignore flag in .gitattributes.

If there has been a discussion first about this, please let me know.

santilin avatar Apr 18 '19 08:04 santilin

WP-CLI is focused on WordPress plugins, not git repositories. The official plugin repository, for example, still uses SVN, not git.

I think it would make sense, though, to investigate the possibility to have the dist-archive command fall back to interpret .gitattributes if the .distignore is missing.

schlessera avatar Apr 18 '19 08:04 schlessera

To use the .gitattributes the approach is different. In that case, and provided that you have a git repository, you have to use git archive witch handles all the exclusions and can create a .zip or a .tar.gz.

So, probably the best way is to tell dist-archive in advance if we want to use git to make the archive and if true use .gitattributes, or else use .distignore.

santilin avatar Apr 18 '19 08:04 santilin

Anyway, I would like to argue that it shouldn't be the responsibility of dist-archive command to tell if a .tar.gz or a .zip file should be in the archive, but the responsibility of the maintainer to add those files to .distignore.

If dist-archive doesn't include archived files, the plugin might be unable to include some required files, like, for example, compressed font files or any other kind of data that the plugin needs.

santilin avatar Apr 18 '19 08:04 santilin

I asked about this on Slack and while .org does not "allow compressed files like zips, tar, etc, in a plugin", I think this CLI command is really used for non .org deployments, so their "rules" aren't so relevant.

I think the scaffold-package-command is more targeted at .org plugins than this command, so adding the default exclusions is appropriate there.

I do think *.zip, *.tar should be added to the documentation showing a default .distignorein the README, and a *.zip (i.e. a *.something) test added to the test suite.

BrianHenryIE avatar Jun 20 '22 03:06 BrianHenryIE