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

[#678] Updated .gitignore configs. #679

Merged
merged 1 commit into from
Jul 3, 2024

Conversation

AlexSkrypnyk
Copy link
Collaborator

@AlexSkrypnyk AlexSkrypnyk commented Jul 2, 2024

Closes #678

This PR updates the root .gitignore managed by this project to "offload" scaffold files management, including exclusions of the contrib scaffold files, to Drupal Scaffold to minimise the maintenance effort for the consumer sites.

Please note that Drupal Scaffold now provides .gitignore files that exclude contrib directories. This PR tries to rely on the files provided by the Drupal Scaffold and only override what is really necessary for granular control within consumer projects.

Below is a table describing:

  • Who provides the content of the file - where the files come from to the Consumer site
  • Who manages the content of the file - updates to the file after they are downloaded
  • Who ignores the file

DS == Drupal Scaffold
DP == Drupal Project (this template)
C == Consumer site

Path Provided by Managed by Ignored by
.
├── .editorconfig DS DP/C DP
├── .env.example DP DP DP
├── .gitattributes DS DS DP
├── .github
│   └── workflows N/A N/A
│   └── ci.yml N/A N/A
├── .gitignore DP DP
├── LICENSE N/A N/A
├── README.md N/A N/A
├── composer.json DP DP/C
├── composer.lock N/A N/A N/A
├── drush
│   ├── Commands
│   │   └── PolicyCommands.php
│   ├── README.md
│   ├── drush.yml
│   └── sites
│   └── self.site.yml
├── load.environment.php
├── phpunit.xml.dist
├── scripts
│   └── composer
│   └── ScriptHandler.php
└── web
├── .csslintrc DS DS
├── .eslintignore DS DS
├── .eslintrc.json DS DS
├── .gitignore DS DS DP
├── .ht.router.php DS DS
├── .htaccess DS DS
├── README.md DS DS
├── autoload.php DS DS
├── example.gitignore DS DS
├── index.php DS DS
├── core DS DS
├── modules
│   ├── .gitignore DS DS DP
│   └── README.txt DS DS DS
├── profiles
│   ├── .gitignore DS DS DP
│   └── README.txt DS DS DS
├── robots.txt DS DS DS
├── sites
│   ├── .gitignore DS DS DP
│   ├── README.txt DS DS DS
│   ├── default
│   │   ├── .gitignore DS DS DP
│   │   ├── default.services.yml DS DS DS
│   │   ├── default.settings.php DS DS DS
│   │   ├── files
│   │   └── settings.php DS DS DS
│   ├── development.services.yml DS DS DS
│   ├── example.settings.local.php DS DS DS
│   └── example.sites.php DS DS DS
├── themes
│   ├── .gitignore DS DS DP
│   └── README.txt DS DS DP
├── update.php DS DS DS
└── web.config DS DS DS
19 directories, 56 files

Please see inline comments for suggested changes.

@AlexSkrypnyk AlexSkrypnyk self-assigned this Jul 2, 2024
@@ -0,0 +1,17 @@
# Drupal editor configuration normalization
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Providing this file in a template allows to have a "place" to put additional editor configurations.

@@ -1,4 +1,7 @@
# Ignore directories generated by Composer
# To ignore OS temporary files use global .gitignore
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The local-specific overrides should be managed by users themselves using a global .gitignore. Ignoring vendor-specific entries make this selection biased, so it is better to exclude them from the list. The entries removed below.

/web/sites/*/settings.php
/web/sites/*/settings.local.php
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

this and missed services.local.yml files are now managed with Drupal Scaffold .gitignore files created during composer install.

@AlexSkrypnyk AlexSkrypnyk force-pushed the feature/678-update-gitignore branch from 2cdee71 to b08e7c8 Compare July 2, 2024 10:50

# Manage all .gitignore files with Drupal scaffold.
# Remove the line below and commit the files for more granular control.
**/.gitignore
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Drupal Scaffold now provides .gitignore files for every directory used by contribs. This template now suggests relying on Drupal Scaffold to manage those ignores rather than managing them in consumer projects (which is, subjectively, easier to maintain).

@@ -63,6 +63,11 @@
"extra": {
"composer-exit-on-patch-failure": true,
"drupal-scaffold": {
"file-mapping": {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Important section

@@ -63,6 +63,11 @@
"extra": {
"composer-exit-on-patch-failure": true,
"drupal-scaffold": {
"file-mapping": {
"[project-root]/.gitignore": false,
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The .gitignore provided by this template replaces the .gitignore provided by Drupal scaffold as an "example" since our files is an "extended example".

@@ -63,6 +63,11 @@
"extra": {
"composer-exit-on-patch-failure": true,
"drupal-scaffold": {
"file-mapping": {
"[project-root]/.gitignore": false,
"[web-root]/INSTALL.txt": false,
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Explicitly exclude both INSTALL and README as these files have been reported to be a source of identification of the Drupal version (on misconfigured servers), that opens an additional attack vector.

@AlexSkrypnyk AlexSkrypnyk requested a review from leymannx July 2, 2024 11:27
@AlexSkrypnyk AlexSkrypnyk added the PR: Needs review Pull request needs a review from assigned developers label Jul 2, 2024
@AlexSkrypnyk AlexSkrypnyk marked this pull request as ready for review July 2, 2024 11:27
@leymannx
Copy link
Collaborator

leymannx commented Jul 2, 2024

Wow this is great stuff. Proper work and superbe comments! 👌🏻

@AlexSkrypnyk AlexSkrypnyk merged commit 428eaee into 10.x Jul 3, 2024
30 checks passed
@AlexSkrypnyk AlexSkrypnyk deleted the feature/678-update-gitignore branch August 14, 2024 12:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
PR: Needs review Pull request needs a review from assigned developers
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Update or remove .gitignore from template
2 participants