Skip to content

fix: support reading environment files as build assets#193

Open
techouse wants to merge 3 commits into
mainfrom
fix/relative-path
Open

fix: support reading environment files as build assets#193
techouse wants to merge 3 commits into
mainfrom
fix/relative-path

Conversation

@techouse

@techouse techouse commented Jun 7, 2026

Copy link
Copy Markdown
Collaborator

This pull request enhances the environment variable loading logic in the envied_generator package to support reading environment files as build assets, improving compatibility with build systems and enabling better testability. It also introduces new tests for workspace resolution and updates dependencies to support these changes.

Environment variable loading improvements:

  • Updated the loadEnvs, loadEnvsFromPaths, and _loadEnv functions in load_envs.dart to accept an optional BuildStep parameter, allowing environment files to be loaded as build assets when available. This enables compatibility with build systems like build_runner and improves testability. [1] [2] [3]
  • Added the _assetIdForPath helper to resolve asset IDs for relative paths when a BuildStep is provided, gracefully handling errors and mock build steps.
  • Passed the buildStep parameter from the code generator to the environment loading functions to ensure consistent asset resolution during code generation.

Testing and dependencies:

  • Added workspace_resolution_test.dart to test loading environment files as build assets, including scenarios with inherited environment files and default files, ensuring correctness in a build system context.
  • Added build_test as a development dependency to support the new tests.

@techouse techouse added this to the 1.3.6 milestone Jun 7, 2026
@techouse techouse requested a review from petercinibulk as a code owner June 7, 2026 10:10
@techouse techouse added the bug Something isn't working label Jun 7, 2026
@techouse techouse linked an issue Jun 7, 2026 that may be closed by this pull request
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.

.env path is resolved relative breaking build_runner --workspace

2 participants