-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathredownload-electron-bins.js
50 lines (43 loc) · 1.56 KB
/
redownload-electron-bins.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
const { spawn } = require('child_process');
const electronVersion = require('./config').appMetadata.electronVersion;
if (process.env.ELECTRON_CUSTOM_VERSION !== electronVersion) {
const electronEnv = process.env.ELECTRON_CUSTOM_VERSION;
console.info(
`env var ELECTRON_CUSTOM_VERSION is not set,\n` +
`or doesn't match electronVersion in ../package.json.\n` +
`(is: "${electronEnv}", wanted: "${electronVersion}").\n` +
`Setting, and re-downloading chromedriver and mksnapshot.\n`
);
process.env.ELECTRON_CUSTOM_VERSION = electronVersion;
const downloadChromedriverPath = require.resolve(
'electron-chromedriver/download-chromedriver.js'
);
const downloadMksnapshotPath = require.resolve(
'electron-mksnapshot/download-mksnapshot.js'
);
const downloadChromedriver = spawn('node', [downloadChromedriverPath]);
const downloadMksnapshot = spawn('node', [downloadMksnapshotPath]);
var exitStatus;
downloadChromedriver.on('close', code => {
if (code === 0) {
exitStatus = 'success';
} else {
exitStatus = 'error';
}
console.info(
`info: Done re-downloading chromedriver. Status: ${exitStatus}`
);
});
downloadMksnapshot.on('close', code => {
if (code === 0) {
exitStatus = 'success';
} else {
exitStatus = 'error';
}
console.info(`info: Done re-downloading mksnapshot. Status: ${exitStatus}`);
});
} else {
console.info(
'info: env var "ELECTRON_CUSTOM_VERSION" is already set correctly.\n(No need to re-download chromedriver or mksnapshot). Skipping.\n'
);
}