fix: support loading environment files from hidden directories#198
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
Restores envied_generator support for loading env files from hidden paths (e.g. .env/.env.dev) under build_runner, while avoiding accidentally reading unrelated unreadable (potentially generated) assets from disk. Adds regression coverage and documents the watch/incremental rebuild limitation for hidden sources.
Changes:
- Add a hidden-path fallback in env loading to read package-relative files directly from disk when
build_runnercannot read the asset. - Add unit tests to validate hidden-path loading and ensure non-hidden unreadable assets do not bypass the asset graph.
- Add an end-to-end
build_runnerregression test and update README documentation with recommendedbuild.yamlsourcesglobs.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| packages/envied_generator/lib/src/load_envs.dart | Adds hidden-path detection and a package-relative filesystem fallback when the asset graph can’t read hidden env files. |
| packages/envied_generator/test/workspace_resolution_test.dart | Adds tests for hidden env path loading and for preventing bypass on non-hidden unreadable assets; extends test helper to simulate unreadable assets. |
| packages/envied_generator/test/hidden_directory_build_runner_test.dart | Adds an end-to-end build_runner regression test using a temporary consumer package without build.yaml. |
| packages/envied_generator/test/.env/.env.dev | Adds hidden env fixture used by tests. |
| packages/envied_generator/test/stale_generated.env | Adds fixture used to validate unreadable asset behavior. |
| packages/envied/README.md | Documents hidden env path behavior and the build.yaml sources configuration to enable watch/incremental rebuild triggers. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Collaborator
Author
petercinibulk
approved these changes
Jun 25, 2026
This was referenced Jun 27, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR fixes #197 and restores support for environment files inside hidden directories, such as
.env/.env.dev, without requiring a consumerbuild.yaml.Changes
build.yaml.sourcesconfiguration.Testing
envied_generatorsuite: 170 tests passeddart analyzedart format --set-exit-if-changed