Skip to content

Add .gitattributes to exclude development files from archives - #63

Open
fadrian06 wants to merge 1 commit into
leafsphp:v5.xfrom
fadrian06:reduce-package-size
Open

fadrian06 wants to merge 1 commit into
leafsphp:v5.xfrom
fadrian06:reduce-package-size

Conversation

@fadrian06

Copy link
Copy Markdown
Contributor

What kind of change does this PR introduce? (pls check at least one)

  • Bugfix
  • Feature
  • Code style update
  • Refactor
  • Build-related changes
  • Other, please describe below

https://getcomposer.org/doc/02-libraries.md[#](https://getcomposer.org/doc/02-libraries.md#light-weight-distribution-packages)light-weight-distribution-packages

.gitattributes allows you to drastically reduce the size of packages installable with composer, by not including files that are irrelevant to the package's client developer.

Consider that:

File/Folder Reduction
/.github -1.69 KB
/tests -46 KB
root files -9.37 KB
------------- -----------
Total: -57.06 KB
xychart-beta
    title "Composer Package Size Comparison (KB)"
    x-axis ["Before", "After"]
    y-axis "Size (KB)" 0 --> 130
    bar [120, 62.94]
Loading
Listado de rutas de carpetas para el volumen SYSTEM
El n路mero de serie del volumen es 0AB2-FA6B
C:.
|   composer.json
\---vendor
     +---leafs
     |   +---auth
-    |   |   |   .env.example.php
-    |   |   |   .gitignore
-    |   |   |   alchemy.yml
-    |   |   |   composer.json
-    |   |   |   phpstan-baseline.neon
-    |   |   |   README.md
     |   |   |   
-    |   |   +---.github
-    |   |   |   \---workflows
-    |   |   |           ...
     |   |   |           
     |   |   +---src
     |   |   |   |   ...
     |   |   |           
-    |   |   \---tests
-    |   |           ...

See one example: https://github.com/flightphp/core/releases/tag/v3.5.0

Description

This pull request adds export-ignore rules to the .gitattributes file, ensuring that several configuration, test, and documentation files are excluded when creating source code archives. This helps reduce archive size and prevents unnecessary files from being distributed.

Does this PR introduce a breaking change? (check one)

  • Yes
  • No

Add .gitattributes with export-ignore rules for development and CI
files. This ensures that archives generated via git archive or GitHub
do not include unnecessary files like tests and configurations.
Copilot AI lite review requested due to automatic review settings September 11, 2026 02:57

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

馃煛 Changes recommended

Keep composer.json in distributed archives.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

Adds .gitattributes rules to reduce Composer archive size by excluding development-only files.

Changes:

  • Excludes CI, tests, configuration, metadata, and documentation files.
  • composer.json must remain included in distributions.
File summaries
File Description
.gitattributes Adds archive exclusion rules. Critical (1 vote): excluding composer.json prevents standalone Composer installation and inspection.
Review details
  • Files reviewed: 1/1 changed files
  • Comments generated: 1
  • Review effort level: Lite

馃挕 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread .gitattributes
.gitattributes export-ignore
.gitignore export-ignore
alchemy.yml export-ignore
composer.json export-ignore
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.

2 participants