-
Notifications
You must be signed in to change notification settings - Fork 997
Exclude non-essential files using .gitattributes
#6107
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
base: main
Are you sure you want to change the base?
Exclude non-essential files using .gitattributes
#6107
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
/features export-ignore | ||
/bin export-ignore | ||
/phpunit.xml.dist export-ignore | ||
/composer.json export-ignore |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/composer.json export-ignore |
There's an argument in favour of keeping composer.json
so people can quickly read it to better understand the package.
You should also keep and/or link configuration files, as for example, the composer.json file in order to allow others to review, study, and yes, fork this code.
https://developer.wordpress.org/plugins/wordpress-org/common-issues/#included-unneeded-folders
/composer.lock export-ignore | ||
/utils export-ignore | ||
/.phpcs.xml.dist export-ignore | ||
/.editorconfig export-ignore |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think these are also valid to exclude, being only dev related files:
/.editorconfig export-ignore | |
/.actrc export-ignore | |
/.editorconfig export-ignore | |
/.gitattributes export-ignore | |
/.gitignore export-ignore | |
/.mailmap export-ignore | |
/.behat.yml export-ignore | |
/phpcs.xml.dist export-ignore | |
/phpstan.neon.dist export-ignore |
/bin export-ignore | ||
/phpunit.xml.dist export-ignore | ||
/composer.json export-ignore | ||
/composer.lock export-ignore |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/composer.lock export-ignore |
There is no composer.lock
in this repository.
Line 13 in 03d30d4
composer.lock |
/.github export-ignore | ||
/tests export-ignore | ||
/features export-ignore | ||
/bin export-ignore |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/bin export-ignore |
I think excluding /bin
would mean vendor/bin/wp
would not work when WP CLI is installed via Composer.
Lines 54 to 57 in 03d30d4
"bin": [ | |
"bin/wp", | |
"bin/wp.bat" | |
], |
.gitattributes
If we find this useful, we should (automatically) add this to all our repos. Would save a lot of bandwidth :) Wonder how this affects https://github.com/wp-cli/wp-cli-dev though |
I think {
"name": "wp-cli/wp-cli-dev",
"config": {
"preferred-install": "source"
}
} "preferred-install": {
"type": ["string", "object"],
"description": "The install method Composer will prefer to use, defaults to auto and can be any of source, dist, auto, or an object of {\"pattern\": \"preference\"}.",
"additionalProperties": {
"type": ["string"]
}
},
I haven't tested it yet. |
Summary
This PR adds a
.gitattributes
file to exclude development-only and non-essential files from distribution packages. This helps reduce package size and ensures that only relevant files are included when the project is exported or packaged via Composer.Changes Made
.gitattributes
to exclude:Benefits
Related References
.gitattributes
: https://getcomposer.org/doc/articles/vendor-binaries.md#excluding-files-from-classmaps