Skip to content

Commit b4658ef

Browse files
authored
docs: add custom dir placeholder explainer to installation guide (electron#22491)
* docs: add custom dir placeholder explainer to installation docs * docs: provide a more concrete example of using ELECTRON_CUSTOM_DIR
1 parent 2563681 commit b4658ef

File tree

1 file changed

+18
-4
lines changed

1 file changed

+18
-4
lines changed

docs/tutorial/installation.md

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,19 +56,33 @@ can do so by either providing a mirror or an existing cache directory.
5656

5757
#### Mirror
5858
You can use environment variables to override the base URL, the path at which to
59-
look for Electron binaries, and the binary filename. The url used by `@electron/get`
59+
look for Electron binaries, and the binary filename. The URL used by `@electron/get`
6060
is composed as follows:
6161

62-
```plaintext
62+
```javascript
6363
url = ELECTRON_MIRROR + ELECTRON_CUSTOM_DIR + '/' + ELECTRON_CUSTOM_FILENAME
6464
```
6565

66-
For instance, to use the China mirror:
66+
For instance, to use the China CDN mirror:
6767

68-
```plaintext
68+
```shell
6969
ELECTRON_MIRROR="https://cdn.npm.taobao.org/dist/electron/"
7070
```
7171

72+
By default, `ELECTRON_CUSTOM_DIR` is set to `v$VERSION`. To change the format,
73+
use the `{{ version }}` placeholder. For example, `version-{{ version }}`
74+
resolves to `version-5.0.0`, `{{ version }}` resolves to `5.0.0`, and
75+
`v{{ version }}` is equivalent to the default. As a more concrete example, to
76+
use the China non-CDN mirror:
77+
78+
```shell
79+
ELECTRON_MIRROR="https://npm.taobao.org/mirrors/electron/"
80+
ELECTRON_CUSTOM_DIR="{{ version }}"
81+
```
82+
83+
The above configuration will download from URLs such as
84+
`https://npm.taobao.org/mirrors/electron/8.0.0/electron-v8.0.0-linux-x64.zip`.
85+
7286
#### Cache
7387
Alternatively, you can override the local cache. `@electron/get` will cache
7488
downloaded binaries in a local directory to not stress your network. You can use

0 commit comments

Comments
 (0)