Skip to content

Clarify settings page #669

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

Open
sdavids opened this issue May 22, 2025 · 1 comment
Open

Clarify settings page #669

sdavids opened this issue May 22, 2025 · 1 comment

Comments

@sdavids
Copy link

sdavids commented May 22, 2025

https://pnpm.io/settings

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:

  1. 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.

  1. 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:

  1. Is ~/.config/pnpm hard coded? — Or is it ${XDG_CONFIG_HOME:=${HOME}/.config}/pnpm?

  2. 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?

@sdavids
Copy link
Author

sdavids commented May 22, 2025

How other tools document this situation:

Spring Boot

https://docs.spring.io/spring-boot/reference/features/external-config.html#features.external-config.typesafe-configuration-properties.relaxed-binding.environment-variables

Quarkus

https://quarkus.io/guides/config-reference#environment-variables


Alternatively, you could add the env variable to the setting description:

loglevel

Default: info
Type: debug, info, warn, error
Any logs at or higher than the given level will be shown. You can instead pass --silent to turn off all output logs.

loglevel

Default: info
Type: debug, info, warn, error
Environment Variable: PNPM_LOG_LEVEL
Any logs at or higher than the given level will be shown. You can instead pass --silent to turn off all output logs.

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

No branches or pull requests

1 participant