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

Make Twig a Composer "light-weight-distribution-package" #942

Closed
wants to merge 3 commits into from
Closed

Make Twig a Composer "light-weight-distribution-package" #942

wants to merge 3 commits into from

Conversation

carlosbuenosvinos
Copy link

In order to save space and bandwidth when installing Twig using Composer, I have added .gitattributes removing files and folders unnecessary when using Twig as a dependecy.

(extracted from http://getcomposer.org/doc/02-libraries.md#light-weight-distribution-packages)

Including the tests and other useless information like .travis.yml in distributed packages is not a good idea.

The .gitattributes file is a git specific file like .gitignore also living at the root directory of your library. It overrides local and global configuration (.git/config and ~/.gitconfig respectively) when present and tracked by git.

Use .gitattributes to prevent unwanted files from bloating the zip distribution packages.

// .gitattributes
/Tests export-ignore
phpunit.xml.dist export-ignore
Resources/doc/ export-ignore
.travis.yml export-ignore
Test it by inspecting the zip file generated manually:

git archive branchName --format zip -o file.zip

Note: Files would be still tracked by git just not included in the distribution. This will only work for GitHub packages installed from dist (i.e. tagged releases) for now.

AUTHORS export-ignore
CHANGELOG export-ignore
phpunit.xml.dist export-ignore
README.markdown export-ignore
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please don't ignore the readme and the changelog. These files are meant to be read by the users.

@carlosbuenosvinos
Copy link
Author

Done!

@fabpot
Copy link
Contributor

fabpot commented Jan 7, 2013

Closing this as the benefits are very small compared to the drawbacks. (see symfony/symfony#6605 for more information).

@fabpot fabpot closed this Jan 7, 2013
fabpot added a commit that referenced this pull request Oct 17, 2019
This PR was squashed before being merged into the 2.x branch (closes #3153).

Discussion
----------

Update .gitattributes to remove tests from "dist"

This was proposed many times before, but considering symfony/symfony#33579 is now merged, I propose this again. I refer to that issue as for the reasoning, as it applies here also.

I did not add the `docs` directory as there was much discussion about that before (discussion in  #942)

Related: #942 #1776 #1981 #2292 #2799 2905

Commits
-------

5cde1f5 Update .gitattributes to remove tests from \"dist\"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants