Skip to content
This repository was archived by the owner on Nov 17, 2021. It is now read-only.

Make Swiftmailer a Composer "light-weight-distribution-package" #268

Closed
wants to merge 1 commit into from
Closed

Conversation

carlosbuenosvinos
Copy link

In order to save space and bandwidth when installing this package using Composer, I have added .gitattributes in order not to include unnecessary files and folders (doc, tests, etc.) when packaging (git archive).

(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.

@sstok
Copy link
Contributor

sstok commented Jan 5, 2013

👍

@fabpot
Copy link
Member

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
@barryvdh
Copy link
Contributor

And what about just removing the notes directory from the distributed zip? That is about 50% (2 MB) of the total package.

ciarand added a commit to ciarand/swiftmailer that referenced this pull request Dec 25, 2014
Inspired by @barryvdh's comment in swiftmailer#268. This dramatically decreases the
size of the generated archive (~50% savings).

```
$ git log --oneline -n 1
e29c7b6 bumped version to 5.3.2-DEV
$ git archive -o without_patch.zip HEAD .
$ echo "/notes export-ignore" >> ./.gitattributes
$ git ci -am "Ignore /notes when generating an archive"
$ git archive -o with_patch.zip HEAD .
$ du -h with{,out}_patch.zip
428K    with_patch.zip
1.0M    without_patch.zip
```
fabpot added a commit that referenced this pull request Jan 18, 2015
This PR was merged into the 5.3-dev branch.

Discussion
----------

Ignore /notes in git-generated .zip archives

Inspired by @barryvdh's comment in #268. This dramatically decreases the
size of the generated archive (a little more than a 50% size reduction).

```bash
$ git log --oneline -n 1
e29c7b6 bumped version to 5.3.2-DEV
$ git archive -o without_patch.zip HEAD .
$ echo "/notes export-ignore" >> ./.gitattributes
$ git ci -am "Ignore /notes in git-generated .zip archives"
$ git archive -o with_patch.zip HEAD .
$ du -h with{,out}_patch.zip
428K    with_patch.zip
1.0M    without_patch.zip
```

Is including the RFCs worth a 100% size increase for most developers?

Commits
-------

7409cbf Ignore /notes in git-generated .zip archives
fabpot added a commit that referenced this pull request Feb 11, 2020
This PR was merged into the 6.2-dev branch.

Discussion
----------

Update .gitattributes to remove tests from "dist"

| Q             | A
| ------------- | ---
| Bug fix?      | no
| New feature?  | yes
| Doc update?   | no
| BC breaks?    | no
| Deprecations? | no
| Fixed tickets | #268 #804 #839
| License       | MIT

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.

Commits
-------

e5e0ce0 Update .gitattributes
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy