Skip to content

Support glob patterns in srcDir#132

Open
DustinJSilk wants to merge 1 commit into
wsporto:mainfrom
DustinJSilk:main
Open

Support glob patterns in srcDir#132
DustinJSilk wants to merge 1 commit into
wsporto:mainfrom
DustinJSilk:main

Conversation

@DustinJSilk

@DustinJSilk DustinJSilk commented Jun 29, 2026

Copy link
Copy Markdown

Motivation / Use Case
Currently, we're building a domain-driven architecture and want to colocate our queries closely with their callers to improve maintainability. However, because srcDir captures everything within the specified directory, we run into issues with mixed file types.

For example, we want to compile our query files (src/domain_1/queries/*.sql and src/domain_2/queries/*.sql), but we actively want to exclude other SQL files living in the same domains, such as src/domain_1/migration.sql.

Proposed Solution
This PR updates srcDir to support glob patterns (e.g., srcDir: src/**/queries).

  • Backwards Compatible: Standard directory paths continue to work exactly as they did before, meaning this won't break existing configurations.
  • Minimal API Change: It leverages the existing config property rather than adding new ones.

Why not other approaches?

  • Centralized Directory: We considered the alternative of centralizing everything into a server/queries/ directory (e.g., server/queries/domain_1/ mirroring server/domain_1/). However, colocation keeps domain logic bounded and is vastly preferable for our project structure.
  • Ignore Files: I saw a previous closed PR suggesting an ignoreFiles option. I believe allowing globs directly in srcDir is a cleaner, more flexible solution that keeps the configuration surface area small while solving the same problem.

Would love to hear your thoughts on this approach!

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