5 Star 23 Fork 0

星雪/优纪插件

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
.puppeteerrc.cjs 1.32 KB
一键复制 编辑 原始数据 按行查看 历史
const os = require('os');
const { existsSync } = require('fs');
const { execSync } = require('child_process');
const arch = os.arch();
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) {}
/**
* @type {string} 浏览器 "可执行文件路径" 列表,可根据需要自行修改或添加
*/
if (!executablePath)
for (const item of [
// Windows
'C:/Program Files/Google/Chrome/Application/chrome.exe',
'C:/Program Files (x86)/Microsoft/Edge/Application/msedge.exe',
// macOS
'/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;
}
/**
* @type {import("puppeteer").Configuration}
*/
module.exports = { skipDownload, executablePath };
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/snowtafir/yuki-plugin.git
[email protected]:snowtafir/yuki-plugin.git
snowtafir
yuki-plugin
优纪插件
main3

搜索帮助