forked from yoimiya-kokomi/Miao-Yunzai
-
Notifications
You must be signed in to change notification settings - Fork 37
/
Copy path.puppeteerrc.cjs
37 lines (32 loc) · 1.09 KB
/
.puppeteerrc.cjs
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
const arch = require("os").arch()
const { existsSync } = require("fs")
const { execSync } = require("child_process")
let skipDownload = false
let executablePath
if (["linux", "android"].includes(process.platform))
for (const item of [
"chromium",
"chromium-browser",
"chrome",
"google-chrome",
]) try {
const chromiumPath = execSync(`command -v ${item}`).toString().trim()
if (chromiumPath && existsSync(chromiumPath)) {
executablePath = chromiumPath
break
}
} catch (err) {}
if (!executablePath) for (const item of [
"C:/Program Files/Google/Chrome/Application/chrome.exe",
"C:/Program Files (x86)/Microsoft/Edge/Application/msedge.exe",
"/Applications/Google Chrome.app/Contents/MacOS/Google Chrome",
"/Applications/Microsoft Edge.app/Contents/MacOS/Microsoft Edge",
]) if (existsSync(item)) {
executablePath = item
break
}
if (executablePath || arch == "arm64" || arch == "aarch64") {
(typeof logger != "undefined" ? logger : console).info(`[Chromium] ${executablePath}`)
skipDownload = true
}
module.exports = { skipDownload, executablePath }