Skip to content

fix: support loading environment files from hidden directories#198

Merged
petercinibulk merged 2 commits into
mainfrom
fix/issue-197
Jun 25, 2026
Merged

fix: support loading environment files from hidden directories#198
petercinibulk merged 2 commits into
mainfrom
fix/issue-197

Conversation

@techouse

Copy link
Copy Markdown
Collaborator

This PR fixes #197 and restores support for environment files inside hidden directories, such as .env/.env.dev, without requiring a consumer build.yaml.

Changes

  • Falls back to package-relative filesystem reads for hidden env paths excluded from build_runner’s asset graph.
  • Keeps non-hidden unreadable assets isolated to avoid reading stale generated files.
  • Adds an end-to-end build_runner regression test using a consumer package without build.yaml.
  • Documents the incremental/watch-mode limitation and optional sources configuration.

Testing

  • Full envied_generator suite: 170 tests passed
  • dart analyze
  • dart format --set-exit-if-changed

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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_runner cannot 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_runner regression test and update README documentation with recommended build.yaml sources globs.

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.

@techouse

Copy link
Copy Markdown
Collaborator Author

@petercinibulk 🙏

@petercinibulk petercinibulk merged commit 1eab1b9 into main Jun 25, 2026
5 checks passed
@techouse techouse deleted the fix/issue-197 branch June 25, 2026 11:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Release v1.3.6 regression - env files in a hidden directory can no longer be read by build_runner

3 participants