-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
docs: improve command line environment variable tips #16490
base: main
Are you sure you want to change the base?
Conversation
This comment was marked as outdated.
This comment was marked as outdated.
I update the mention of I also shortened the longer bit of text, I think all the needed info is still nicely there. Side note, it's nice to finally give back to Bun, the experience has been great and the built-in environment utilities are probably one of the biggest reasons for having migrated personally. Also, thanks for your review @RiskyMH, let me know if any more changes are needed! |
Looks good to me 👍 |
What does this PR do?
Improves the existing docs section for setting variables through the command line.
The method currently described in the docs is the following:
The problem is this syntax is only available on POSIX-compliant shells, which mostly means MacOS and Linux. I assumed that bit was a leftover from when Bun did not support Windows and had yet to be updated.
I've recently seen a significant number of Windows users being confused as to why following the docs on this was not working, so I decided to clarify where that syntax is available.
In addition to that I added a cross-platform alternative for setting variables like previously expected, although I'm open to feedback if you think it's not clean enough to be in the official docs. It makes use of a somewhat chained and lengthy
bun exec
syntax.I believe the presence of the examples added by this PR are important as I found myself and other peers regularly needing specific
package.json
commands to set theNODE_ENV
variable, for example.