Description
pnpm gets its configuration from the command line, environment variables, pnpm-workspace.yaml, and .npmrc files.
The pnpm config command can be used to read and edit the contents of the project and global configuration files.
Two issues:
- You should specify in which order the different setting options are applied/overwritten, e.g.
Builtin npmrc - /path/to/npm/npmrc
Global npmrc - ${NPM_CONFIG_GLOBALCONFIG:=$PREFIX/etc/npmrc}
User .npmrc - ${NPM_CONFIG_USERCONFIG:=$HOME/.npmrc}
Global Conf - ${XDG_CONFIG_HOME:=${HOME}/.config}/pnpm/rc
Project .npmrc - /path/to/my/project/.npmrc
Project Conf /path/to/my/project/pnpm-workspace.yaml
Env
CLI
https://docs.npmjs.com/cli/v11/using-npm/config#npmrc-files
What if you use them all, e.g. global config file, env variable, and pnpm-workspace.yaml all contain the same setting but with different values.
- How do you map a setting to its corresponding environment variable?
https://pnpm.io/settings#node-mirror
node-mirror
https://pnpm.io/settings#executionenvnodeversion
executionEnv.nodeVersion
SCREAMING_SNAKE_CASE? SCREAMING_SNAKE_CASE with a PNPM
prefix?
What do you do with -
, .
, or :
?
node-mirror:release=https://npmmirror.com/mirrors/node/
executionEnv.nodeVersion=16.16.0
Can certain settings only be set via one option, i.e. only via pnpm-workspace.yaml
, only via CLI, or only via env var? — Or can all settings be set via all options?
Global configuration file: ~/.config/pnpm/rc (an INI-formatted list of key = value parameters)
Two issues:
-
Is
~/.config/pnpm
hard coded? — Or is it${XDG_CONFIG_HOME:=${HOME}/.config}/pnpm
? -
What is the format of the keys?
https://pnpm.io/settings#fetchretries
fetchRetries
https://pnpm.io/settings#node-mirror
node-mirror
https://pnpm.io/settings#executionenvnodeversion
executionEnv.nodeVersion
fetchRetries=5
node-mirror:release=https://npmmirror.com/mirrors/node/
executionEnv.nodeVersion=16.16.0
Are the keys case sensitive? Should they be in SCREAMING_SNAKE_CASE? SCREAMING_SNAKE_CASE with a PNPM
prefix?