Skip to content

Use parseEnv instead of dotenv and avoid side effects#1947

Merged
bluwy merged 11 commits into
nextfrom
remove-dotenv
May 4, 2026
Merged

Use parseEnv instead of dotenv and avoid side effects#1947
bluwy merged 11 commits into
nextfrom
remove-dotenv

Conversation

@bluwy
Copy link
Copy Markdown
Member

@bluwy bluwy commented Apr 30, 2026

https://nodejs.org/api/process.html#processloadenvfilepath exists since the recent required nodejs version bump. We no longer need to use and upgrade the dotenv dependency.

close #1931

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Apr 30, 2026

🦋 Changeset detected

Latest commit: f126035

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
@changesets/changelog-github Patch
@changesets/get-github-info Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 30, 2026

Codecov Report

❌ Patch coverage is 30.00000% with 21 lines in your changes missing coverage. Please review.
✅ Project coverage is 81.90%. Comparing base (8e9afd1) to head (f126035).
⚠️ Report is 1 commits behind head on next.

Files with missing lines Patch % Lines
packages/get-github-info/src/index.ts 35.29% 11 Missing ⚠️
packages/changelog-github/src/index.ts 23.07% 10 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             next    #1947      +/-   ##
==========================================
- Coverage   82.61%   81.90%   -0.72%     
==========================================
  Files          54       54              
  Lines        2422     2442      +20     
  Branches      718      721       +3     
==========================================
- Hits         2001     2000       -1     
- Misses        379      400      +21     
  Partials       42       42              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Comment thread .changeset/late-animals-drive.md Outdated
"@changesets/changelog-github": patch
---

Use `loadEnvFile` instead of `dotenv` to load the `.env` file
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
Use `loadEnvFile` instead of `dotenv` to load the `.env` file
Replaced `dotenv` with `loadEnvFile` for loading `.env` files

i think generally changesets should use past tense, as they are a log of what has changed in a package, compared to commit descriptions that use present tense as they describe what a commit does or will do to a repository

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I've always used present tense here as they work like git commits to me. It depends how you read it but they could also describe what a specific version does. I don't think we need to standardize the format for now though.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

it would be nice to have one before the v3 release to make it look nicer though :)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

we should go through the final changesets/changelog updates manually before releasing final v3 anyway, so we should be able to adjust the lanaguage then

Comment thread packages/changelog-github/src/index.ts Outdated
Comment thread packages/changelog-github/src/index.ts Outdated
@@ -1,8 +1,15 @@
import { loadEnvFile } from "node:process";
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I have a semi-strong beef with unexpected side effects. This isn't new here, of course, but given we touch this now - what do you think about using util.parseEnv instead of this? It would be a couple of LOC more but I think it would be nice to avoid the side-effect and do this lazily.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

that's true, it shouldn't effect the rest of the code

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I pushed out that change, let me know what do you think about this.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Yeah I agree too. Personally I wouldn't want a package to implicitly read a .env file altogether though but we can think of the more breaking change in the future. The change now shouldn't be a big deal.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Yeah, I think .env support is kinda esoteric here. OTOH, it's pretty cheap so 🤷 but I doubt that many people rely on this. It was introduced when there was only one env variable supported too (GITHUB_TOKEN)

@bluwy bluwy changed the title Use loadEnvFile instead of dotenv Use parseEnv instead of dotenv and avoid side effects May 4, 2026
@bluwy
Copy link
Copy Markdown
Member Author

bluwy commented May 4, 2026

@Andarist Should we cache and only load the env files once? From the code paths it looks like it could be called repeatedly

@Andarist
Copy link
Copy Markdown
Member

Andarist commented May 4, 2026

ye, that's a good idea

Comment thread packages/get-github-info/README.md Outdated
@bluwy bluwy merged commit 492b0ca into next May 4, 2026
8 of 10 checks passed
@bluwy bluwy deleted the remove-dotenv branch May 4, 2026 07:36
@github-actions github-actions Bot mentioned this pull request May 4, 2026
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.

3 participants