Skip to content

Commit f2aa153

Browse files
authored
feat: update to 3.0.0 stable (#33)
1 parent 2ffa656 commit f2aa153

File tree

5 files changed

+4166
-35
lines changed

5 files changed

+4166
-35
lines changed

chromedriver.js

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,22 @@
11
#!/usr/bin/env node
22

3-
var ChildProcess = require('child_process')
4-
var path = require('path')
3+
const ChildProcess = require('child_process')
4+
const path = require('path')
55

6-
var command = path.join(__dirname, 'bin', 'chromedriver')
7-
var args = process.argv.slice(2)
8-
var options = {
6+
const command = path.join(__dirname, 'bin', 'chromedriver')
7+
const args = process.argv.slice(2)
8+
const options = {
99
cwd: process.cwd(),
1010
env: process.env,
1111
stdio: 'inherit'
1212
}
1313

14-
var chromeDriverProcess = ChildProcess.spawn(command, args, options)
14+
const chromeDriverProcess = ChildProcess.spawn(command, args, options)
1515

16-
var killChromeDriver = function () {
16+
const killChromeDriver = () => {
1717
try {
1818
chromeDriverProcess.kill()
19-
} catch (ignored) {
20-
}
19+
} catch (ignored) {}
2120
}
2221

2322
process.on('exit', killChromeDriver)

download-chromedriver.js

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
var fs = require('fs')
2-
var path = require('path')
3-
var electronDownload = require('electron-download')
4-
var extractZip = require('extract-zip')
5-
var versionToDownload = require('./package').version
1+
const fs = require('fs')
2+
const path = require('path')
3+
const electronDownload = require('electron-download')
4+
const extractZip = require('extract-zip')
5+
const versionToDownload = require('./package').version
66

77
function download (version, callback) {
88
electronDownload({
9-
version: version,
9+
version,
1010
chromedriver: true,
1111
platform: process.env.npm_config_platform,
1212
arch: process.env.npm_config_arch,
@@ -17,20 +17,20 @@ function download (version, callback) {
1717

1818
function processDownload (err, zipPath) {
1919
if (err != null) throw err
20-
extractZip(zipPath, {dir: path.join(__dirname, 'bin')}, function (error) {
20+
extractZip(zipPath, {dir: path.join(__dirname, 'bin')}, error => {
2121
if (error != null) throw error
2222
if (process.platform !== 'win32') {
23-
fs.chmod(path.join(__dirname, 'bin', 'chromedriver'), '755', function (error) {
23+
fs.chmod(path.join(__dirname, 'bin', 'chromedriver'), '755', error => {
2424
if (error != null) throw error
2525
})
2626
}
2727
})
2828
}
2929

30-
download(versionToDownload, function (err, zipPath) {
30+
download(versionToDownload, (err, zipPath) => {
3131
if (err) {
32-
var versionSegments = versionToDownload.split('.')
33-
var baseVersion = versionSegments[0] + '.' + versionSegments[1] + '.0'
32+
const parts = versionToDownload.split('.')
33+
const baseVersion = `${parts[0]}.${parts[1]}.0`
3434
download(baseVersion, processDownload)
3535
} else {
3636
processDownload(err, zipPath)

0 commit comments

Comments
 (0)