Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?

Env vars

Sandboxing

  • NOTION_HOME

Tool overrides

Possible environment variables

  • NOTION_NODE=10.3.0
  • NOTION_NPM=6.4.0
  • NOTION_YARN=1.7.0
  • NOTION_PACKAGES='typescript:2.9.2' (most likely should be separated as future work)

How it works

  • Notion consults these env vars first; they take precedence over config
  • Just like config, they install just-in-time if necessary
  • Unclear how to implement NOTION_PACKAGES; needs investigation:
    • whether package managers make this possible without mutating the manifest/lockfile
    • could potentially work with some more aggressive copying/moving directories, but seems nonobvious
    • possibly could be made efficient in conjunction with Yarn plug n play / tink?

Commands

Exec

  • notion exec --node=10.3.0 --npm=6.4.0 node -v
  • notion exec --typescript=2.9.2 tsc

Modify environment

I might prefer something like:

  • notion shell --node=10.3.0

instead of the nvm nvm use approach. It boots up a subshell with the environment variables you choose set up, instead of mutating an environment variable in the current shell.

The reasons I prefer it:

  • Mutation operations can only be supported in shells that implement the shell function wrapper; this doesn't require that.
  • We don't really want to encourage people to set these environment variables permanently -- they should be for temporary overrides. The nvm use style means you always have the cognitive overhead of having to remember the current environment variable. Overrides should be understood as something you need for temporary situations.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment