Have command line options take precedence over environment variables
- Dominant language
- JavaScript
- Stars
- 1.2k
- Forks
- 271
- Avg merge
- 23h 40m
- Merged PRs (30d)
- 2
Description
Given the following command:
```bash
npm_config_runtime=electron node-pre-gyp install --runtime=node
```
I would expect that `node-pre-gyp` would install for the `node` runtime, but rather it uses the `electron` runtime.
Our use-case is that we have a `.yarnrc` that defines the environment variable, and were trying to run `node-pre-gyp` as part of a yarn run-script to install a native dependency for node for our CI pipeline for testing. I ended up creating a wrapper script around calling `node-pre-gyp` that deleted the `npm_config_*` environment variables that were overriding the option flags I was trying to use.
Contributor guide
Research direction
Reproduce the shown node-pre-gyp install command with conflicting npm_config_runtime and --runtime values, then trace where command-line options and environment variables are parsed. Done means the explicit --runtime=node value takes precedence over the electron environment setting, with coverage for the conflicting-input case.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, node.js
- Domain
- cli, tooling
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100