Skip to content

Commit 1cc6c51

Browse files
committed
ci: auto detect chrome version
1 parent 6a2ca0a commit 1cc6c51

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

scripts/patchChromedriver.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ const fs = require('fs')
55
const path = require('path')
66
const pkg = require('../package.json')
77

8-
pkg.resolutions.chromedriver = '2.45.0'
8+
const versionString = require('child_process').execSync('wmic datafile where name="C:\\\\Program Files (x86)\\\\Google\\\\Chrome\\\\Application\\\\chrome.exe" get Version /value').toString()
9+
const majorVersion = versionString.match(/Version=(\d+)/)[1]
10+
pkg.resolutions.chromedriver = `^${majorVersion}.0.0`
911

1012
fs.writeFileSync(path.resolve(__dirname, '../package.json'), JSON.stringify(pkg, null, 2))

0 commit comments

Comments
 (0)