mirror of
https://wget.la/https://github.com/Wxw-Gu/WechatExplorer
synced 2026-10-04 03:01:42 +08:00
feat: 修复定时日报错误通知微信机器人功能
增加定时日报debug 修复定时日报历史头像显示并区分定时日报标题
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
/* eslint-disable @typescript-eslint/no-require-imports, @typescript-eslint/explicit-function-return-type */
|
||||
const { execFileSync } = require('node:child_process')
|
||||
const fs = require('node:fs')
|
||||
const path = require('node:path')
|
||||
|
||||
const projectRoot = path.resolve(__dirname, '..')
|
||||
const defaultRuntimeRoot = path.join(projectRoot, 'node_modules', 'sherpa-onnx-win-x64')
|
||||
const requiredFiles = ['package.json', 'sherpa-onnx.node']
|
||||
|
||||
function hasWindowsSherpaRuntime(runtimeRoot = defaultRuntimeRoot) {
|
||||
return requiredFiles.every((fileName) => fs.existsSync(path.join(runtimeRoot, fileName)))
|
||||
}
|
||||
|
||||
function ensureWindowsSherpaRuntime() {
|
||||
if (hasWindowsSherpaRuntime()) {
|
||||
console.log('[prepare-win-runtime] sherpa-onnx-win-x64 is ready')
|
||||
return
|
||||
}
|
||||
|
||||
console.log('[prepare-win-runtime] installing cross-platform optional dependencies')
|
||||
execFileSync(
|
||||
process.platform === 'win32' ? 'pnpm.cmd' : 'pnpm',
|
||||
['install', '--force', '--ignore-scripts'],
|
||||
{
|
||||
cwd: projectRoot,
|
||||
stdio: 'inherit'
|
||||
}
|
||||
)
|
||||
|
||||
if (!hasWindowsSherpaRuntime()) {
|
||||
throw new Error(`Missing Windows sherpa runtime: ${defaultRuntimeRoot}`)
|
||||
}
|
||||
}
|
||||
|
||||
if (require.main === module) ensureWindowsSherpaRuntime()
|
||||
|
||||
module.exports = { hasWindowsSherpaRuntime, ensureWindowsSherpaRuntime }
|
||||
Reference in New Issue
Block a user