jetify-com / devbox

Instant, easy, and predictable development environments
https://www.jetify.com/devbox/
Apache License 2.0
8.2k stars 192 forks source link

feat: Add recompute flag to shellenv command #1963

Closed dax closed 4 months ago

dax commented 4 months ago

Summary

(related issue) When used with direnv and when regularly switching between branches, Devbox slows down the workflow because it tries to keep the packages in sync with the devbox.lock state with a Ensuring packages are installed. This PR add the --recompute flag to the shellenv command that allow to set it to --recompute=false and then disable the automatic installation of package in case devbox.json is out of sync.

How was it tested?

Setting the .envrc (ie. the direnv config file) as:

devbox shellenv --init-hook --no-refresh-alias --recompute=false

--install has been removed and --recompute=false compared with what devbox generate direnv --print-envrc generate by default.

Then updating devbox.json does not trigger package installation or removal but the context (ie. the env vars) are correctly updated.

savil commented 4 months ago

would you mind also running devbox run lint to ensure the code is considered "clean"?

savil commented 4 months ago

devbox run fmt should help with formatting concerns

dax commented 4 months ago

Would you wanna make that change?

Thank you @savil for the suggestion. I'll push an update soon (and run the linter and formatter 😄 )

dax commented 4 months ago

@savil The PR is now ready 🙏

dax commented 4 months ago

Thanks @mikeland73 for spotting the regression 🙏 I guess I can close this PR as @savil now have submitted a cleaner one 🙏