0
0
mirror of https://github.com/tj/n.git synced 2024-11-25 07:39:21 +01:00

Document the preferred env for custom source

This commit is contained in:
John Gee 2019-05-09 21:29:32 +12:00
parent 5370e2432e
commit c7cfc64bf1
2 changed files with 13 additions and 14 deletions

View File

@ -9,6 +9,14 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
## [Unreleased]
### Added
- describe `NODE_MIRROR` in `README`
### Removed
- `PROJECT_NAME` and `PROJECT_URL` from `README`. First step to deprecating `n project`. Open an issue if you still need this!
## [4.0.0]
Only minor functional changes, but technically could break scripts relying on specific behaviour.

View File

@ -155,22 +155,13 @@ Output can also be obtained from `n --help`.
## Custom source
If you would like to use a project other than the official Node.js project, you can use the special `n project [command]` which allows you to control the behavior of `n` using environment variables.
If you would like to use a different node mirror which has the same layout as the default <https://nodejs.org/dist/>, you can define `NODE_MIRROR`.
The most common example is users in China can define:
For example, to grab the latest io.js version:
```
export NODE_MIRROR=https://npm.taobao.org/mirrors/node
```
PROJECT_NAME="iojs" PROJECT_URL="https://iojs.org/dist/" n project latest
Required Variables:
- `PROJECT_NAME`: The name the project will be stored under
- `PROJECT_URL`: The location to download the project from. Note, this must follow the same format as the Node.js repos
Optional Variables:
- `HTTP_USER`: The username if the `PROJECT_URL` is protected by basic authentication
- `HTTP_PASSWORD`: The password if the `PROJECT_URL` is protected by basic authentication
- `PROJECT_VERSION_CHECK`: Many custom projects keep the same version number as the Node.js release they are based on, and maintain their own separate version in process. This allows you to define a JavaScript variable that will be used to check for the version of the process, for example: `process.versions.node`
## Custom architecture