{{ message }}
Repository navigation
Commit 1822dff
authored
feat: support reading config from package.json (#3196)
`npm@11` has deprecated setting arbitrary config values (npm/cli#8153), which was the previously recommended place for users to set node-gyp related config. The new recommendation from npm is to use the `config` object in package.json for this (npm/cli#8153 (comment)). I think it makes sense to follow npm's recommendation here.
When a user sets a value in `package.json#config` it will be set in the environment by npm with the prefix `npm_package_config_<KEY>`.
I think it makes sense to allow prescribe that they keys be prefixed with `node_gyp_`. So as an example:
**package.json**
```json
{
"config": {
"node_gyp_devdir": "/tmp/.gyp"
}
}
```
Then in `node-gyp` we can read the env var `npm_package_config_node_gyp_devdir`. If a user wants to set a global value, they can set that env var on their system.
Fixes #31561 parent 0773615 commit 1822dff
3 files changed
Lines changed: 73 additions & 27 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
122 | 122 | | |
123 | 123 | | |
124 | 124 | | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
125 | 136 | | |
126 | | - | |
127 | | - | |
128 | | - | |
129 | | - | |
130 | | - | |
131 | | - | |
132 | | - | |
133 | | - | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
134 | 145 | | |
135 | | - | |
136 | | - | |
137 | | - | |
138 | | - | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
139 | 152 | | |
140 | | - | |
141 | | - | |
142 | | - | |
143 | | - | |
144 | | - | |
| 153 | + | |
145 | 154 | | |
146 | | - | |
| 155 | + | |
147 | 156 | | |
148 | 157 | | |
149 | 158 | | |
| 159 | + | |
150 | 160 | | |
151 | 161 | | |
152 | 162 | | |
| |||

0 commit comments