#How am I supposed to configure .env in a monorepo?
1 messages · Page 1 of 1 (latest)
^ checks for cwd.
I do this in my packages @brazen yoke
"dev": "bun with-env vinxi dev",
"with-env": "bun --env-file=../../.env --bun",```
It'd be a much better idea to use --filter to run scripts in the correct working directory. This will just end up takign a lot more time
just adding with-env in your apps doesn't take that long, then run with --filter from root
If you have maybe two child directories maybe. But if you ever end up needing more or changing it around, you're gonna have to change them all at some point
best practice regardless is to use --filter
i don't think i am understanding - how are you using filter?
bun run --filter web setup:web:blah
bun --filter <pattern> <script>
what does that have to do with envs?
../../.env this specifically <- --filter will properly utilize any .env in the same working directory as the directories found in the pattern
oh yeah, but he wanted just 1 .env no?
and for any top level .env it will inherit below
Top level env will be the same in sub dirs, he’s got more than one package directory I would assume. If it’s undefined in pkg then it is then not top level.
Regardless I think your suggestion was not the best yes
Personally, I just copy or simlink
why not just have profile-global constants then?