mirror of
https://github.com/atom/atom.git
synced 2026-04-28 03:01:47 -04:00
Ensure chromedriver matches electron version during build
This commit is contained in:
@@ -23,6 +23,7 @@ const argv = yargs
|
||||
.wrap(yargs.terminalWidth())
|
||||
.argv
|
||||
|
||||
const checkChromedriverVersion = require('./lib/check-chromedriver-version')
|
||||
const cleanOutputDirectory = require('./lib/clean-output-directory')
|
||||
const codeSignOnMac = require('./lib/code-sign-on-mac')
|
||||
const compressArtifacts = require('./lib/compress-artifacts')
|
||||
@@ -47,6 +48,7 @@ process.on('unhandledRejection', function (e) {
|
||||
process.exit(1)
|
||||
})
|
||||
|
||||
checkChromedriverVersion()
|
||||
cleanOutputDirectory()
|
||||
copyAssets()
|
||||
transpileBabelPaths()
|
||||
|
||||
22
script/lib/check-chromedriver-version.js
Normal file
22
script/lib/check-chromedriver-version.js
Normal file
@@ -0,0 +1,22 @@
|
||||
'use strict'
|
||||
|
||||
const buildMetadata = require('../package.json')
|
||||
const CONFIG = require('../config')
|
||||
const semver = require('semver')
|
||||
|
||||
module.exports = function () {
|
||||
// Chromedriver should be specified as ~x.y where x and y match Electron major/minor
|
||||
const chromedriverVer = buildMetadata.dependencies['electron-chromedriver']
|
||||
|
||||
// Always use tilde on electron-chromedriver so that it can pick up the best patch vesion
|
||||
if (!chromedriverVer.startsWith('~')) {
|
||||
throw new Error(`electron-chromedriver version in script/package.json should start with a tilde to match latest patch version.`)
|
||||
}
|
||||
|
||||
const electronVer = CONFIG.appMetadata.electronVersion
|
||||
if (!semver.satisfies(electronVer, chromedriverVer)) {
|
||||
throw new Error(`electron-chromedriver ${chromedriverVer} incompatible with electron ${electronVer}.\n` +
|
||||
'Did you upgrade electron in package.json and forget to upgrade electron-chromedriver in ' +
|
||||
`script/package.json to '~${semver.major(electronVer)}.${semver.minor(electronVer)}' ?`)
|
||||
}
|
||||
}
|
||||
@@ -8,7 +8,7 @@
|
||||
"colors": "1.1.2",
|
||||
"csslint": "1.0.2",
|
||||
"donna": "1.0.13",
|
||||
"electron-chromedriver": "^1.3.0",
|
||||
"electron-chromedriver": "~1.3",
|
||||
"electron-packager": "7.3.0",
|
||||
"electron-winstaller": "2.5.0",
|
||||
"fs-extra": "0.30.0",
|
||||
|
||||
Reference in New Issue
Block a user