feat: .husky & format

This commit is contained in:
ningmengchongshui 2024-06-08 21:09:19 +08:00
parent 37712f726a
commit a0f71e8730
2 changed files with 51 additions and 29 deletions

View File

@ -1,2 +1,21 @@
# Node dependencies # Node dependencies
node_modules node_modules
# 旧版文件夹
config
docker
lib
plugins
renderers
# 旧版文件
CHANGELOG.md
docker-compose.yaml
miao.js
# 缓存目录
data
trss.js

View File

@ -7,40 +7,43 @@ let skipDownload = false
let executablePath let executablePath
if (process.platform === 'linux' || process.platform === 'android') if (process.platform === 'linux' || process.platform === 'android')
for (const item of [ for (const item of ['chromium', 'chromium-browser', 'chrome'])
"chromium", try {
"chromium-browser", const chromiumPath = execSync(`command -v ${item}`).toString().trim()
"chrome", if (chromiumPath && existsSync(chromiumPath)) {
]) try { executablePath = chromiumPath
const chromiumPath = execSync(`command -v ${item}`).toString().trim() break
if (chromiumPath && existsSync(chromiumPath)) { }
executablePath = chromiumPath } catch (err) {}
break
}
} catch (err) {}
// macOS // macOS
if (process.platform === 'darwin') for (const item of [ if (process.platform === 'darwin')
'/Applications/Google Chrome.app/Contents/MacOS/Google Chrome', for (const item of [
'/Applications/Microsoft Edge.app/Contents/MacOS/Microsoft Edge', '/Applications/Google Chrome.app/Contents/MacOS/Google Chrome',
]) if (existsSync(item)) { '/Applications/Microsoft Edge.app/Contents/MacOS/Microsoft Edge'
executablePath = item ])
break if (existsSync(item)) {
} executablePath = item
break
}
if (!executablePath) for (const item of [ if (!executablePath)
'/usr/bin/chromium', for (const item of [
'/usr/bin/chromium-browser', '/usr/bin/chromium',
'/usr/bin/chrome', '/usr/bin/chromium-browser',
'C:/Program Files/Google/Chrome/Application/chrome.exe', '/usr/bin/chrome',
'C:/Program Files (x86)/Microsoft/Edge/Application/msedge.exe', 'C:/Program Files/Google/Chrome/Application/chrome.exe',
]) if (existsSync(item)) { 'C:/Program Files (x86)/Microsoft/Edge/Application/msedge.exe'
executablePath = item ])
break if (existsSync(item)) {
} executablePath = item
break
}
if (executablePath || arch === 'arm64' || arch === 'aarch64') { if (executablePath || arch === 'arm64' || arch === 'aarch64') {
(typeof logger == 'object' ? logger : console).info(`[Chromium] ${executablePath}`) ;(typeof logger == 'object' ? logger : console).info(
`[Chromium] ${executablePath}`
)
skipDownload = true skipDownload = true
} }