Skip to content

Commit

Permalink
docs: clarity on relative paths vs config_root in _.path (#3923)
Browse files Browse the repository at this point in the history
Make Node.JS cookbook only recommend one style instead of both.
  • Loading branch information
glasser authored Jan 5, 2025
1 parent 09e5252 commit ecfc3f6
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
10 changes: 7 additions & 3 deletions docs/environments/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,18 +90,22 @@ See [secrets](/environments/secrets) for ways to read encrypted files with `env.

### `env._.path`

`PATH` is treated specially, it needs to be defined as a string/array in `mise.path`:
`PATH` is treated specially. It needs to be defined as a string/array in `mise.path`:

```toml
[env]
_.path = [
# adds an absolute path
"~/.local/share/bin",
# adds a path relative to the mise.toml, not PWD
"./node_modules/.bin",
# adds paths relative to directory in which this file was found (see below for details), not PWD
"{{config_root}}/node_modules/.bin",
# adds paths relative to the exact file that this is found in (not PWD)
"tools/bin",
]
```

Adding a relative path like `tools/bin` or `./tools/bin` is similar to adding a path rooted at `{{config_root}}`, but behaves differently if your config file is nested in a subdirectory like `/path/to/project/.config/mise/config.toml`. Including `tools/bin` will add the path `/path/to/project/.config/mise/tools/bin`, whereas including `{{config_root}}/tools/bin` will add the path `/path/to/project/tools/bin`.

### `env._.source`

Source an external bash script and pull exported environment variables out of it:
Expand Down
2 changes: 1 addition & 1 deletion docs/mise-cookbook/nodejs.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ A nice trick you can use is to add the node modules binaries to the PATH. This w

```toml [mise.toml]
[env]
_.path = ['./node_modules/.bin']
_.path = ['{{config_root}}/node_modules/.bin']
```

Example:
Expand Down

0 comments on commit ecfc3f6

Please sign in to comment.