Skip to content

Conversation

@TravisCarden
Copy link

The symlink-project command helpfully provides a way to override the list of files it should symlink via the PROJECT_FILES environment variable. This is great if you're willing to hardcode the list, but more than a little difficult to achieve if you want a dynamic list. In order to get the most production-like version of my module placed, I wanted to not symlink any files that would be omitted by the Drupal.org Composer Facade, i.e., those that aren't excluded via .gitattributes export-ignore. (At first I wanted to exclude those in .gitignore, too, but then I realized that could incorrectly exclude compiled code, like CSS and JS.) And I didn't want to hardcode that list and set future developers up for failure when they add new files and forget about it.

So I came up with a solution. It works for me, and I'm satisfied with it. I don't know if it will interest anyone else, but I thought I'd put it out there in case it could help someone. I don't necessarily expect that it will actually be merged.

How This PR Solves The Issue

It makes the default behavior in symlink-project exclude not only the hardcoded list of common files but also any that are in .gitattributes with export-ignore. (I also added "docroot" to the default list while I was there, since some hosting providers (e.g., Acquia) use that.

Manual Testing Instructions

ddev add-on get https://github.com/TravisCarden/ddev-drupal-contrib/tarball/feature/dynamic-project-files
ddev restart

# Add a file:
touch test.txt

# See that symlink-project symlinks it. (Expect output "test.txt")
ddev symlink-project 2>/dev/null | grep test.txt

# Add it to .gitattributes:
echo '/test.txt  export-ignore' | tee -a .gitattributes

# See that symlink-project does NOT symlinks it. (Expect no output.)
ddev symlink-project | grep test.txt

Automated Testing Overview

As I'm just "throwing this over the wall", I'm not taking the time to write automated tests.

Release/Deployment Notes

TBD

@TravisCarden TravisCarden force-pushed the feature/dynamic-project-files branch from 8d967e2 to c3e6395 Compare December 6, 2025 00:12
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.

1 participant