1 Star 0 Fork 115

熊锋/Miao-Yunzai

forked from Kokomi/Miao-Yunzai 
Create your Gitee Account
Explore and code with more than 12 million developers,Free private repositories !:)
Sign up
Clone or Download
.puppeteerrc.cjs 1.29 KB
Copy Edit Raw Blame History
Ayakura Yuki authored 2023-09-06 15:33 . fmt
const os = require('os')
const { existsSync } = require('fs')
const { execSync } = require('child_process')
const arch = os.arch()
let skipDownload = false
let executablePath
if (process.platform === 'linux' || process.platform === 'android')
for (const item of [
"chromium",
"chromium-browser",
"chrome",
]) try {
const chromiumPath = execSync(`command -v ${item}`).toString().trim()
if (chromiumPath && existsSync(chromiumPath)) {
executablePath = chromiumPath
break
}
} catch (err) {}
// macOS
if (process.platform === 'darwin') for (const item of [
'/Applications/Google Chrome.app/Contents/MacOS/Google Chrome',
'/Applications/Microsoft Edge.app/Contents/MacOS/Microsoft Edge',
]) if (existsSync(item)) {
executablePath = item
break
}
if (!executablePath) for (const item of [
'/usr/bin/chromium',
'/usr/bin/chromium-browser',
'/usr/bin/chrome',
'C:/Program Files/Google/Chrome/Application/chrome.exe',
'C:/Program Files (x86)/Microsoft/Edge/Application/msedge.exe',
]) if (existsSync(item)) {
executablePath = item
break
}
if (executablePath || arch === 'arm64' || arch === 'aarch64') {
(typeof logger == 'object' ? logger : console).info(`[Chromium] ${executablePath}`)
skipDownload = true
}
module.exports = { skipDownload, executablePath }
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
NodeJS
1
https://gitee.com/XFxiong-feng/Miao-Yunzai.git
git@gitee.com:XFxiong-feng/Miao-Yunzai.git
XFxiong-feng
Miao-Yunzai
Miao-Yunzai
master

Search