Skip to content

Commit

Permalink
update npm config property and PATH names
Browse files Browse the repository at this point in the history
  • Loading branch information
dmlemeshko committed Apr 7, 2020
1 parent afbe418 commit 8a5fc20
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 16 deletions.
42 changes: 29 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ const edgePaths = await installDriver();
const edgeOptions = new edge.Options();
edgeOptions.setEdgeChromium(true);
edgeOptions.setBinaryPath(edgePaths.browserPath);
const driver = new Builder()
const driver = await new Builder()
.forBrowser('MicrosoftEdge')
.setEdgeOptions(edgeOptions)
.setEdgeService(new edge.ServiceBuilder(edgePaths.driverPath))
Expand All @@ -40,11 +40,11 @@ const driver = new Builder()

## Custom binaries url

To use a mirror of the MSEdgeDriver binaries use PATH variable `EDGE_DRIVER_CDNURL`.
To use a mirror of the MSEdgeDriver binaries use PATH variable `EDGEDRIVER_CDNURL`.
Default is `https://msedgedriver.azureedge.net`.

```shell
EDGE_DRIVER_CDNURL=https://<mirror address> npm install ms-chromium-edge-driver
EDGEDRIVER_CDNURL=https://<mirror address> npm install ms-chromium-edge-driver
```

## Custom browser binary path and driver version
Expand All @@ -58,7 +58,7 @@ npm install ms-chromium-edge-driver --npm_config_edge_binary_path=/path/to/Micro
Another option is to use the PATH variable `EDGE_BINARY_PATH`

```shell
EDGE_BINARY_PATH=C:\\Program Files (x86)\\Microsoft\\Edge\\Application
EDGE_BINARY_PATH=C:\\Program Files (x86)\\Microsoft\\Edge\\Application\\msedge.exe
```

On Windows there is an option to pass custom HKEY by using the PATH variable `EDGE_HKEY`:
Expand All @@ -67,42 +67,58 @@ On Windows there is an option to pass custom HKEY by using the PATH variable `ED
EDGE_HKEY=SOFTWARE\\WOW6432Node\\Microsoft\\Windows\\Current\\Version\\Uninstall\\Microsoft Edge
```

In addition, custom driver version can be specified with the npm config property `npm_config_edge_driver_version`
In addition, custom driver version can be specified with the npm config property `npm_config_edgedriver_version`

```shell
npm install ms-chromium-edge-driver --npm_config_edge_driver_version=80.0.361.103
npm install ms-chromium-edge-driver --npm_config_edgedriver_version=80.0.361.103
```

Another option is to use the PATH variable `EDGE_DRIVER_VERSION`
Another option is to use the PATH variable `EDGEDRIVER_VERSION`

```shell
EDGE_DRIVER_VERSION=80.0.361.103
EDGEDRIVER_VERSION=80.0.361.103
```

If both browser binary path and version are provided, the package will skip binary fetch step and start with the driver download.

## Custom driver binary

To get the msedgedriver from the filesystem instead of a web request use the npm config property `npm_config_edge_driver_path`.
To get the msedgedriver from the filesystem instead of a web request use the npm config property `npm_config_edgedriver_path`.

```shell
npm install ms-chromium-edge-driver --npm_config_edge_driver_path=/path/to/msedgedriver.exe
npm install ms-chromium-edge-driver --npm_config_edgedriver_path=/path/to/msedgedriver.exe
```

Or add property into your [`.npmrc`](https://docs.npmjs.com/files/npmrc) file.

```
npm_config_edge_driver_path=/path/to/msedgedriver.exe
npm_config_edgedriver_path=/path/to/msedgedriver.exe
```

Another option is to use the PATH variable `EDGE_DRIVER_PATH`
Another option is to use the PATH variable `EDGEDRIVER_PATH`

```shell
EDGE_DRIVER_PATH=/path/to/msedgedriver.exe
EDGEDRIVER_PATH=/path/to/msedgedriver.exe
```

If both the binary path and driver path are provided, the package will return it skipping browser fetching and driver download steps.

## Download driver during npm install

Driver is not downloaded during npm install by default.

To change this behaviour set the npm config property `npm_config_edgedriver_download_on_install`

```shell
npm install ms-chromium-edge-driver --npm_config_edgedriver_download_on_install=1
```

Another option is to use the PATH variable `EDGEDRIVER_DOWNLOAD_ON_INSTALL`

```shell
EDGEDRIVER_DOWNLOAD_ON_INSTALL=1
```

## License

Licensed under the Apache License, Version 2.0.
6 changes: 3 additions & 3 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ import { pipeline } from 'stream';
import * as extract from 'extract-zip';
import { getBrowserData } from './browser';
import { osName, isSupportedPlatform, isWin } from './os';
const cdnUrl = process.env.EDGE_DRIVER_CDNURL || 'https://msedgedriver.azureedge.net';
const cdnUrl = process.env.EDGEDRIVER_CDNURL || 'https://msedgedriver.azureedge.net';
const mainDir = resolve(__dirname, '..');
const outFile = 'msedgedriver.zip';
let edgeDriverVersion = process.env.npm_config_edge_driver_version || process.env.EDGE_DRIVER_VERSION;
let edgeDriverVersion = process.env.npm_config_edgedriver_version || process.env.EDGEDRIVER_VERSION;
let edgeBinaryPath = process.env.npm_config_edge_binary_path || process.env.EDGE_BINARY_PATH;
let edgeDriverPath = process.env.npm_config_edge_driver_path || process.env.EDGE_DRIVER_PATH;
let edgeDriverPath = process.env.npm_config_edgedriver_path || process.env.EDGEDRIVER_PATH;
const forceDownload = process.env.npm_config_edgedriver_force_download || process.env.EDGEDRIVER_FORCE_DOWNLOAD;
const edgePathFile = 'paths.json';

Expand Down

0 comments on commit 8a5fc20

Please sign in to comment.