Skip to content

Commit

Permalink
fix(docs): remove npm package config override
Browse files Browse the repository at this point in the history
This is no longer possible, as per [rfc
21](https://github.com/npm/rfcs/blob/latest/implemented/0021-reduce-lifecycle-script-environment.md)

PR-URL: #3485
Credit: @wraithgar
Close: #3485
Reviewed-by: @isaacs
  • Loading branch information
wraithgar committed Jun 30, 2021
1 parent 5f8cccc commit 9dd32d0
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 41 deletions.
8 changes: 2 additions & 6 deletions docs/content/configuring-npm/package-json.md
Original file line number Diff line number Diff line change
Expand Up @@ -549,12 +549,8 @@ had the following:
}
```

and then had a "start" command that then referenced the
`npm_package_config_port` environment variable, then the user could
override that by doing `npm config set foo:port 8001`.

See [`config`](/using-npm/config) and [`scripts`](/using-npm/scripts) for
more on package configs.
It could also have a "start" command that referenced the
`npm_package_config_port` environment variable.

### dependencies

Expand Down
36 changes: 1 addition & 35 deletions docs/content/using-npm/scripts.md
Original file line number Diff line number Diff line change
Expand Up @@ -245,41 +245,7 @@ package.json file, then your package scripts would have the
in your code with `process.env.npm_package_name` and
`process.env.npm_package_version`, and so on for other fields.

#### configuration

Configuration parameters are put in the environment with the
`npm_config_` prefix. For instance, you can view the effective `root`
config by checking the `npm_config_root` environment variable.

#### Special: package.json "config" object

The package.json "config" keys are overwritten in the environment if
there is a config param of `<name>[@<version>]:<key>`. For example,
if the package.json has this:

```json
{
"name" : "foo",
"config" : {
"port" : "8080"
},
"scripts" : {
"start" : "node server.js"
}
}
```

and the server.js is this:

```javascript
http.createServer(...).listen(process.env.npm_package_config_port)
```

then the user could change the behavior by doing:

```bash
npm config set foo:port 80
```
See [`package-json.md`](/using-npm/package-json) for more on package configs.

#### current lifecycle event

Expand Down

0 comments on commit 9dd32d0

Please sign in to comment.