webksde / ddev-vscode-devcontainer-drupal-template

Drupal DDEV based development container with attached Visual Studio Code
23 stars 3 forks source link

Place default .gitignore in drowl-init #115

Open JPustkuchen opened 1 year ago

JPustkuchen commented 1 year ago

Context / Problem

When creating a git repository for a whole ddev Drupal project (not just single modules), it's helpful and best practice to have a top-level .gitignore file which ensures only the custom parts are added and especially no secrets are pushed to git.

FYI: Git only cares for the .gitignore file at the level, where the .git repository is created, as it seems

Currently, we don't create a best practice .gitignore at the root level of the project, but we should do. The .gitignore from Drupal at web/.gitignore isn't considered, due to the reason above.

Proposed solution

When running drowl-init, we should place a template best-practice .gitignore file. Here's our current default:

# Ignore directories generated by composer, for temporary or user-generated files
/files/private/
/log/
/tmp/
/vendor/

# Ignore Drupal directories
/web/core/
/web/modules/contrib/
/web/themes/contrib/
/web/profiles/contrib/
/web/libraries/
/web/sites/simpletest/
/drush/contrib/

# Ignore Drupal files
/web/modules/README.txt
/web/profiles/README.txt
/web/sites/development.services.yml
/web/sites/example.settings.local.php
/web/sites/example.sites.php
/web/sites/README.txt
/web/themes/README.txt
/web/autoload.php
/web/example.gitignore
/web/index.php
/web/INSTALL.txt
/web/LICENSE.txt
/web/README.txt
/web/update.php

# Ignore project / environment specific information
/web/.csslintrc
/web/.editorconfig
/web/.eslintignore
/web/.eslintrc.json
/web/.gitattributes
#webksde#JP: We better keep those to be able to restore if something bad happens:
#/web/.htaccess
#/web/.ht.router.php
#/web/web.config
#/web/robots.txt
#/web/composer.json
/web/composer.lock

# Ignore configuration files that may contain sensitive information
/web/sites/*/*settings*.php
/web/sites/*/*services*.yml

# Ignore paths that may contain user-generated content
/web/sites/*/files
/web/sites/*/public
/web/sites/*/private
/web/sites/*/files-public
/web/sites/*/files-private

# Ignore paths that may contain temporary files
/web/sites/*/translations
/web/sites/*/tmp
/web/sites/*/cache

# Ignore directories generated by Composer
/vendor/

# Ignore .env files as they are personal
/.env

# Ignore other configurations
/.editorconfig
/.gitattributes
/.ddev

# Ignore IDE specific files
/.vscode/
/.history/
/.idea/
/.vscode/
*.iml
*.code-workspace

# Ignore all log files
*.log

# Ignore node modules
node_modules

# Ignore css maps
*.css.map

# Ignore local db-dumps
*.sql
*.sql*

# Ignore Packages
*.7z
*.dmg
*.gz
*.bz2
*.iso
*.jar
*.rar
*.tar
*.zip
*.tgz
joshsedl commented 1 year ago

As this repository is mainly used for development purposes, I will postpone this on https://github.com/webksde/ddev-vscode-devcontainer-drupal-template/issues/124