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

Add VOLTA_BYPASS override to short-circuit shim behavior #600

Merged
merged 2 commits into from
Nov 13, 2019

Conversation

charlespierce
Copy link
Contributor

Closes #599

Info

  • volta activate and volta deactivate are built as Shell functions that only work in specific unix shells.
  • They also don't cleanly interact with the proposed update logic since they require a different install process than we want to support.
  • [Updates] Remove 'volta activate' and 'volta deactivate' #562 Removed them as part of the updates work, which is still behind a feature flag for the moment.
  • However, the escape hatch still has uses (most notably to work with custom versions of npm until we implement installing and pinning npm)
  • To provide similar functionality, in a cross-platform way, we want to add a VOLTA_BYPASS environment variable that will cause the shims to skip their normal logic and shell out to the existing (non-Volta) system.

Changes

  • Added logic to execute_tool that checks for the existence of VOLTA_BYPASS.
  • If it is found, we short-circuit to a Passthrough command (i.e. using the system as if Volta didn't exist).
  • We also add a custom error to the Passthrough command that will let the user know about VOLTA_BYPASS being enabled if the command fails to launch (e.g. if the requested tool doesn't exist on the system).

Tested

  • Ran node --version with VOLTA_BYPASS set to verify that it ran the system node instead of the Volta node.
  • Ran yarn --version with VOLTA_BYPASS set to verify that it shows the "Bypass enabled" error if it can't find a system executable.

Copy link
Contributor

@rwjblue rwjblue left a comment

Choose a reason for hiding this comment

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

Thank you for working on this!

Copy link
Contributor

@chriskrycho chriskrycho left a comment

Choose a reason for hiding this comment

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

👏 ⚡️

@chriskrycho chriskrycho merged commit 532d378 into volta-cli:master Nov 13, 2019
@charlespierce charlespierce deleted the volta_bypass branch December 3, 2019 21:38
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.

Add an environment variable to bypass Volta behavior
3 participants