Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(core): update dotenv and load root env variables earlier #18456

Merged
merged 2 commits into from
Aug 9, 2023

Conversation

Coly010
Copy link
Contributor

@Coly010 Coly010 commented Aug 3, 2023

Current Behavior

We currently don't attempt to load dotenv files until the forked process task runner begins to run a task.
There are other Nx Commands that may benefit from the values stored in workspace root dotenv files.

Expected Behavior

Load the workspace root dotenv files during invocation of nx.
Ensure the order that dotenv files are loaded for task remains correct.

Related Issue(s)

Fixes #17634

@Coly010 Coly010 self-assigned this Aug 3, 2023
@vercel
Copy link

vercel bot commented Aug 3, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
nx-dev ❌ Failed (Inspect) Aug 9, 2023 7:32pm

@Coly010 Coly010 marked this pull request as ready for review August 3, 2023 19:10
@Coly010 Coly010 requested a review from a team as a code owner August 3, 2023 19:10
@Coly010 Coly010 changed the title chore(core): load dotenv earlier fix(core): load dotenv earlier Aug 3, 2023
@@ -318,11 +316,17 @@ export class ForkedProcessTaskRunner {
outputPath: string,
streamOutput: boolean
) {
// Unload any dot env files at the root of the workspace that were loaded on init of Nx.
this.unloadDotEnvFiles(process.env);
Copy link
Collaborator

Choose a reason for hiding this comment

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

This shouldn't unload it from the actual process.env

@@ -26,6 +27,8 @@ function main() {
assertSupportedPlatform();
}

loadDotEnvFiles();
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can we add a performance timing here?

@AgentEnder AgentEnder merged commit 0527925 into nrwl:master Aug 9, 2023
15 checks passed
@AgentEnder AgentEnder changed the title fix(core): load dotenv earlier feat(core): update dotenv and load root env variables earlier Aug 9, 2023
@Coly010 Coly010 deleted the dotenv-early branch August 9, 2023 22:48
@github-actions
Copy link

This pull request has already been merged/closed. If you experience issues related to these changes, please open a new issue referencing this pull request.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 15, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

NX_HEAD and NX_BASE not read from .env
3 participants