Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove test-related stuff from production archives #72

Closed
wants to merge 1 commit into from
Closed

Remove test-related stuff from production archives #72

wants to merge 1 commit into from

Conversation

mlocati
Copy link

@mlocati mlocati commented Nov 16, 2016

When installing a release with composer, we get the test-related stuff also.

What about removing this stuff? See the result of this PR here:
https://github.com/mlocati/html2text/archive/remove-from-zip-useless-files-for-production.zip

People that still wants all the non-production-only files may still have these options:

  • git-clone this repository
  • composer require --prefer-source

That way, developers are happy, users are happy... in conclusion, this makes the whole World happier 😉

@mtibben
Copy link
Owner

mtibben commented Nov 16, 2016

Firstly I'm confused about why this would even be necessary. Secondly if it were necessary, it seems this would be a poor choice for implementing. It would basically be relying on a side effect of composer and github to do packaging.

As an alternative I'd suggest just referring to the required file directly when downloading, or vendoring the file directly in your project or writing a script to do what you need to accomplish.

@mtibben mtibben closed this Nov 16, 2016
@mlocati
Copy link
Author

mlocati commented Nov 16, 2016

Firstly I'm confused about why this would even be necessary

Not necessary at all, it's just to avoid having useless files on production machines... Less files means less potential problems / surface of attack by malicious people...

Secondly if it were necessary, it seems this would be a poor choice for implementing. It would basically be relying on a side effect of composer and github to do packaging.

This .gitattributes approach is not related neither to composer not to github: it's a widely used feature of git, and in the git manual it's explicitly mentioned that this approach can be used to remove test-related stuff from archives.

As an alternative I'd suggest just referring to the required file directly when downloading

I'm using composer, so I can't simply download this file. I mean, I could, but it's not a feasible approach since I have to work with many packages, and I don't want a "special" case for every composer package.

or vendoring the file directly in your project or writing a script to do what you need to accomplish.

I wish the world was so easy. Let's assume that I have a lot of composer packages: should I parse each package files, check if they are needed or just for their own development, and cleanup everything.
And this should be done every time a package changes... A total mess...

@mtibben
Copy link
Owner

mtibben commented Nov 16, 2016

it's just to avoid having useless files on production machines

So... it's for aesthetic value? Not a great reason IMO

it's explicitly mentioned that this approach can be used to remove test-related stuff from archives

Yes it can be used, but by making it a default you make assumptions about how the package is used. To me, asking for a github archive shouldn't unexpectedly strip out most of the files. It's the principle of least surprise. This is why I immediately question this PR - this is surprising behaviour.

I wish the world was so easy

If this is really important to you, I'd suggest create a robust method to articulate the intent.

For example, perhaps you create a .productionignore file that a script can read to strip out unwanted files, similar to the way gitignore works. Create the scheme with solid documentation, think about edge-cases, get consensus from other projects, and I'd be happy to include such a file to indicate files to strip out in production

@mlocati
Copy link
Author

mlocati commented Nov 16, 2016

Never mind

@mlocati mlocati deleted the remove-from-zip-useless-files-for-production branch November 16, 2016 22:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants