forked from appium/appium-windows-driver
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall-npm.js
30 lines (26 loc) · 932 Bytes
/
install-npm.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
/* eslint-disable @typescript-eslint/no-var-requires */
const fs = require('fs');
const path = require('path');
const log = require('fancy-log');
async function installWadServer () {
if (process.platform !== 'win32') {
log.info('Not installing WinAppDriver since did not detect a Windows system');
process.exit(0);
}
const installScript = path.resolve(__dirname, 'build', 'lib', 'installer.js');
try {
await fs.promises.access(installScript, fs.constants.R_OK);
} catch (ign) {
log.warn(`Unable to import the install script at '${installScript}'. ` +
`Consider installing WinAppDriver server manually.`);
return;
}
const { setupWAD } = require(installScript);
try {
await setupWAD();
} catch (err) {
log.error(`WinAppDriver server was not installed, consider installing it manually. `
+ `Original error: ${err.message}`);
}
}
(async () => await installWadServer())();