electron-chromedriver 7.0.0-beta.5 → 9.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.circleci/config.yml +14 -4
- package/.github/CODEOWNERS +2 -0
- package/README.md +4 -0
- package/download-chromedriver.js +28 -25
- package/package.json +8 -4
package/.circleci/config.yml
CHANGED
|
@@ -7,7 +7,7 @@ jobs:
|
|
|
7
7
|
install-test-linux:
|
|
8
8
|
docker:
|
|
9
9
|
# specify the version you desire here
|
|
10
|
-
- image: circleci/node:
|
|
10
|
+
- image: circleci/node:10
|
|
11
11
|
|
|
12
12
|
# Specify service dependencies here if necessary
|
|
13
13
|
# CircleCI maintains a library of pre-built images
|
|
@@ -43,7 +43,6 @@ jobs:
|
|
|
43
43
|
xcode: "9.0"
|
|
44
44
|
steps:
|
|
45
45
|
- checkout
|
|
46
|
-
|
|
47
46
|
# Download and cache dependencies
|
|
48
47
|
- restore_cache:
|
|
49
48
|
keys:
|
|
@@ -51,6 +50,19 @@ jobs:
|
|
|
51
50
|
# fallback to using the latest cache if no exact match is found
|
|
52
51
|
- v1-mac-dependencies-
|
|
53
52
|
|
|
53
|
+
# Lock into Node.js version
|
|
54
|
+
- run:
|
|
55
|
+
name: Install Node.js
|
|
56
|
+
command: |
|
|
57
|
+
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.3/install.sh | bash
|
|
58
|
+
export NVM_DIR="$HOME/.nvm"
|
|
59
|
+
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
|
|
60
|
+
nvm install v10.19.0
|
|
61
|
+
nvm alias default v10.19.0
|
|
62
|
+
echo 'export NVM_DIR=${HOME}/.nvm' >> $BASH_ENV
|
|
63
|
+
echo "[ -s '${NVM_DIR}/nvm.sh' ] && . '${NVM_DIR}/nvm.sh'" >> $BASH_ENV
|
|
64
|
+
- run: node --version
|
|
65
|
+
- run: npm --version
|
|
54
66
|
- run: npm install
|
|
55
67
|
|
|
56
68
|
- save_cache:
|
|
@@ -59,8 +71,6 @@ jobs:
|
|
|
59
71
|
key: v1-mac-dependencies-{{ checksum "package.json" }}
|
|
60
72
|
|
|
61
73
|
# run tests!
|
|
62
|
-
- run: node --version
|
|
63
|
-
- run: npm --version
|
|
64
74
|
- run: npm test
|
|
65
75
|
|
|
66
76
|
workflows:
|
package/README.md
CHANGED
|
@@ -39,3 +39,7 @@ ELECTRON_MIRROR="https://npm.taobao.org/mirrors/electron/"
|
|
|
39
39
|
# Example of requested URL: http://localhost:8080/1.2.0/chromedriver-v2.21-darwin-x64.zip
|
|
40
40
|
ELECTRON_MIRROR="http://localhost:8080/"
|
|
41
41
|
```
|
|
42
|
+
|
|
43
|
+
## Overriding the version downloaded
|
|
44
|
+
|
|
45
|
+
The version downloaded can be overriden by setting the `ELECTRON_CUSTOM_VERSION` environment variable.
|
package/download-chromedriver.js
CHANGED
|
@@ -1,38 +1,41 @@
|
|
|
1
|
-
const fs = require('fs')
|
|
1
|
+
const { promises: fs } = require('fs')
|
|
2
2
|
const path = require('path')
|
|
3
|
-
const
|
|
3
|
+
const { downloadArtifact } = require('@electron/get')
|
|
4
4
|
const extractZip = require('extract-zip')
|
|
5
5
|
const versionToDownload = require('./package').version
|
|
6
6
|
|
|
7
|
-
function download (version
|
|
8
|
-
|
|
7
|
+
function download (version) {
|
|
8
|
+
return downloadArtifact({
|
|
9
9
|
version,
|
|
10
|
-
|
|
10
|
+
artifactName: 'chromedriver',
|
|
11
11
|
platform: process.env.npm_config_platform,
|
|
12
12
|
arch: process.env.npm_config_arch,
|
|
13
|
-
|
|
13
|
+
rejectUnauthorized: process.env.npm_config_strict_ssl === 'true',
|
|
14
14
|
quiet: ['info', 'verbose', 'silly', 'http'].indexOf(process.env.npm_config_loglevel) === -1
|
|
15
|
-
}, callback)
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
function processDownload (err, zipPath) {
|
|
19
|
-
if (err != null) throw err
|
|
20
|
-
extractZip(zipPath, { dir: path.join(__dirname, 'bin') }, error => {
|
|
21
|
-
if (error != null) throw error
|
|
22
|
-
if (process.platform !== 'win32') {
|
|
23
|
-
fs.chmod(path.join(__dirname, 'bin', 'chromedriver'), '755', error => {
|
|
24
|
-
if (error != null) throw error
|
|
25
|
-
})
|
|
26
|
-
}
|
|
27
15
|
})
|
|
28
16
|
}
|
|
29
17
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
const
|
|
18
|
+
async function attemptDownload (version) {
|
|
19
|
+
try {
|
|
20
|
+
const targetFolder = path.join(__dirname, 'bin')
|
|
21
|
+
const zipPath = await download(version)
|
|
22
|
+
await extractZip(zipPath, { dir: targetFolder })
|
|
23
|
+
const platform = process.env.npm_config_platform || process.platform
|
|
24
|
+
if (platform !== 'win32') {
|
|
25
|
+
await fs.chmod(path.join(targetFolder, 'chromedriver'), 0o755)
|
|
26
|
+
}
|
|
27
|
+
} catch (err) {
|
|
28
|
+
// attempt to fall back to semver minor
|
|
29
|
+
const parts = version.split('.')
|
|
33
30
|
const baseVersion = `${parts[0]}.${parts[1]}.0`
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
31
|
+
|
|
32
|
+
// don't recurse infinitely
|
|
33
|
+
if (baseVersion === version) {
|
|
34
|
+
throw err
|
|
35
|
+
} else {
|
|
36
|
+
await attemptDownload(baseVersion)
|
|
37
|
+
}
|
|
37
38
|
}
|
|
38
|
-
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
attemptDownload(versionToDownload)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "electron-chromedriver",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "9.0.0",
|
|
4
4
|
"description": "Electron ChromeDriver",
|
|
5
5
|
"repository": "https://github.com/electron/chromedriver",
|
|
6
6
|
"bin": {
|
|
@@ -8,16 +8,20 @@
|
|
|
8
8
|
},
|
|
9
9
|
"scripts": {
|
|
10
10
|
"install": "node ./download-chromedriver.js",
|
|
11
|
+
"lint": "standard --fix",
|
|
11
12
|
"test": "standard && mocha"
|
|
12
13
|
},
|
|
14
|
+
"engines": {
|
|
15
|
+
"node": ">=10.12.0"
|
|
16
|
+
},
|
|
13
17
|
"author": "Kevin Sawicki",
|
|
14
18
|
"license": "MIT",
|
|
15
19
|
"dependencies": {
|
|
16
|
-
"electron
|
|
17
|
-
"extract-zip": "^
|
|
20
|
+
"@electron/get": "^1.12.2",
|
|
21
|
+
"extract-zip": "^2.0.0"
|
|
18
22
|
},
|
|
19
23
|
"devDependencies": {
|
|
20
|
-
"mocha": "^
|
|
24
|
+
"mocha": "^7.1.2",
|
|
21
25
|
"standard": "^13.1.0"
|
|
22
26
|
}
|
|
23
27
|
}
|