From 83212118cbaf7ab44b51f8afcd45a7540275e639 Mon Sep 17 00:00:00 2001 From: Jordi Boggiano Date: Tue, 19 Mar 2024 15:23:35 +0100 Subject: [PATCH] Revert "Remove docs about light-weight packages" This reverts commit b34220edc8ed738bce3f682248622976543d6ec4. --- doc/02-libraries.md | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/doc/02-libraries.md b/doc/02-libraries.md index c731f105d..7b4985937 100644 --- a/doc/02-libraries.md +++ b/doc/02-libraries.md @@ -150,4 +150,34 @@ allows you to submit the URL to your VCS repository, at which point Packagist will start crawling it. Once it is done, your package will be available to anyone! +## Light-weight distribution packages + +Some useless information like the `.github` directory, or large examples, test +data, etc. should typically not be included in distributed packages. + +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. + +```text +// .gitattributes +/demo export-ignore +phpunit.xml.dist export-ignore +/.github/ export-ignore +``` + +Test it by inspecting the zip file generated manually: + +```shell +git archive branchName --format zip -o file.zip +``` + +> **Note:** Files would be still tracked by git just not included in the +> zip distribution. This only works for packages installed from +> dist (i.e. tagged releases) coming from GitHub, GitLab or Bitbucket. + ← [Basic usage](01-basic-usage.md) | [Command-line interface](03-cli.md) →