mirror of
https://github.com/ILoveBingLu/CipherTalk.git
synced 2026-05-18 10:18:52 +08:00
chore: add macOS native artifact checks
This commit is contained in:
@@ -3,7 +3,19 @@
|
||||
"allow": [
|
||||
"Bash(npx tsc --noEmit --pretty)",
|
||||
"Bash(node -e \"const ts = require\\(''typescript''\\); const cfg = ts.readConfigFile\\(''tsconfig.json'', ts.sys.readFile\\); const parsed = ts.parseJsonConfigFileContent\\(cfg.config, ts.sys, ''.''\\); const prog = ts.createProgram\\(parsed.fileNames, parsed.options\\); const diags = ts.getPreEmitDiagnostics\\(prog\\); diags.forEach\\(d => { if\\(d.file && d.file.fileName.includes\\(''htmlExportGenerator''\\)\\) { const {line} = d.file.getLineAndCharacterOfPosition\\(d.start\\); console.log\\(d.file.fileName + '':'' + \\(line+1\\) + '' '' + ts.flattenDiagnosticMessageText\\(d.messageText, ''\\\\n''\\)\\); }}\\); if\\(diags.filter\\(d=>d.file&&d.file.fileName.includes\\(''htmlExportGenerator''\\)\\).length===0\\) console.log\\(''No errors in htmlExportGenerator''\\);\")",
|
||||
"Bash(node -e \"const ts = require\\(''typescript''\\); const cfg = ts.readConfigFile\\(''tsconfig.json'', ts.sys.readFile\\); const parsed = ts.parseJsonConfigFileContent\\(cfg.config, ts.sys, ''.''\\); const prog = ts.createProgram\\(parsed.fileNames, parsed.options\\); const diags = ts.getPreEmitDiagnostics\\(prog\\); diags.forEach\\(d => { if\\(d.file && d.file.fileName.includes\\(''exportService''\\)\\) { const {line} = d.file.getLineAndCharacterOfPosition\\(d.start\\); console.log\\(d.file.fileName + '':'' + \\(line+1\\) + '' '' + ts.flattenDiagnosticMessageText\\(d.messageText, ''\\\\n''\\)\\); }}\\); if\\(diags.filter\\(d=>d.file&&d.file.fileName.includes\\(''exportService''\\)\\).length===0\\) console.log\\(''No errors in exportService''\\);\")"
|
||||
"Bash(node -e \"const ts = require\\(''typescript''\\); const cfg = ts.readConfigFile\\(''tsconfig.json'', ts.sys.readFile\\); const parsed = ts.parseJsonConfigFileContent\\(cfg.config, ts.sys, ''.''\\); const prog = ts.createProgram\\(parsed.fileNames, parsed.options\\); const diags = ts.getPreEmitDiagnostics\\(prog\\); diags.forEach\\(d => { if\\(d.file && d.file.fileName.includes\\(''exportService''\\)\\) { const {line} = d.file.getLineAndCharacterOfPosition\\(d.start\\); console.log\\(d.file.fileName + '':'' + \\(line+1\\) + '' '' + ts.flattenDiagnosticMessageText\\(d.messageText, ''\\\\n''\\)\\); }}\\); if\\(diags.filter\\(d=>d.file&&d.file.fileName.includes\\(''exportService''\\)\\).length===0\\) console.log\\(''No errors in exportService''\\);\")",
|
||||
"Bash(gh pr:*)",
|
||||
"Bash(git worktree:*)",
|
||||
"Read(//d/JiQingzhe/GitHub项目/半开源密语-pr99/**)",
|
||||
"Bash(npm install:*)",
|
||||
"Bash(npm run:*)",
|
||||
"Bash(gh api:*)",
|
||||
"Bash(gh auth:*)",
|
||||
"WebFetch(domain:github.com)",
|
||||
"Read(//d/JiQingzhe/GitHub项目/CipherTalk-wiki/**)"
|
||||
],
|
||||
"additionalDirectories": [
|
||||
"d:\\JiQingzhe\\GitHub项目\\CipherTalk-wiki"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,6 +8,8 @@
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
"prebuild": "node scripts/update-readme-version.js",
|
||||
"native:macos": "bash native-dlls/build-macos.sh",
|
||||
"native:macos:check": "node scripts/check-macos-native.js",
|
||||
"build:full": "node scripts/build-full.js",
|
||||
"build": "tsc && vite build && electron-builder && node scripts/add-size-to-yml.js",
|
||||
"build:pro": "node scripts/build-full.js",
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
# macOS Native Resources
|
||||
|
||||
这个目录是 CipherTalk 的 macOS 原生产物落点。
|
||||
|
||||
当前仓库会长期保留的静态文件:
|
||||
|
||||
- `entitlements.mac.plist`
|
||||
- `image_scan_entitlements.plist`
|
||||
|
||||
需要在 mac 机器上通过 `native-dlls/build-macos.sh` 生成的文件:
|
||||
|
||||
- `libwx_key.dylib`
|
||||
- `xkey_helper`
|
||||
- `image_scan_helper`
|
||||
- `libwcdb_api.dylib`
|
||||
- `libwcdb_decrypt.dylib`
|
||||
|
||||
检查是否齐全:
|
||||
|
||||
```bash
|
||||
npm run native:macos:check
|
||||
```
|
||||
|
||||
只构建 mac 原生产物,不构建 Electron 应用:
|
||||
|
||||
```bash
|
||||
npm run native:macos
|
||||
```
|
||||
@@ -0,0 +1,70 @@
|
||||
const fs = require('fs')
|
||||
const path = require('path')
|
||||
|
||||
const rootDir = path.resolve(__dirname, '..')
|
||||
const macosDir = path.join(rootDir, 'resources', 'macos')
|
||||
|
||||
const requiredArtifacts = [
|
||||
{ name: 'libwx_key.dylib', type: 'file', generated: true },
|
||||
{ name: 'xkey_helper', type: 'file', generated: true },
|
||||
{ name: 'image_scan_helper', type: 'file', generated: true },
|
||||
{ name: 'libwcdb_api.dylib', type: 'file', generated: true },
|
||||
{ name: 'libwcdb_decrypt.dylib', type: 'file', generated: true },
|
||||
{ name: 'entitlements.mac.plist', type: 'file', generated: false },
|
||||
{ name: 'image_scan_entitlements.plist', type: 'file', generated: false }
|
||||
]
|
||||
|
||||
function statSafe(targetPath) {
|
||||
try {
|
||||
return fs.statSync(targetPath)
|
||||
} catch {
|
||||
return null
|
||||
}
|
||||
}
|
||||
|
||||
function main() {
|
||||
console.log(`[macos-native-check] target dir: ${macosDir}`)
|
||||
|
||||
if (!fs.existsSync(macosDir)) {
|
||||
console.error('[macos-native-check] resources/macos does not exist')
|
||||
process.exit(1)
|
||||
}
|
||||
|
||||
const missing = []
|
||||
const present = []
|
||||
|
||||
for (const artifact of requiredArtifacts) {
|
||||
const targetPath = path.join(macosDir, artifact.name)
|
||||
const stat = statSafe(targetPath)
|
||||
|
||||
if (!stat || (artifact.type === 'file' && !stat.isFile())) {
|
||||
missing.push(artifact)
|
||||
continue
|
||||
}
|
||||
|
||||
present.push({
|
||||
name: artifact.name,
|
||||
size: stat.size,
|
||||
generated: artifact.generated
|
||||
})
|
||||
}
|
||||
|
||||
if (present.length > 0) {
|
||||
console.log('[macos-native-check] present:')
|
||||
for (const item of present) {
|
||||
console.log(` - ${item.name} (${item.size} bytes)${item.generated ? ' [generated]' : ' [static]'}`)
|
||||
}
|
||||
}
|
||||
|
||||
if (missing.length > 0) {
|
||||
console.error('[macos-native-check] missing:')
|
||||
for (const item of missing) {
|
||||
console.error(` - ${item.name}${item.generated ? ' [build required]' : ''}`)
|
||||
}
|
||||
process.exit(2)
|
||||
}
|
||||
|
||||
console.log('[macos-native-check] all required macOS native artifacts are present')
|
||||
}
|
||||
|
||||
main()
|
||||
Reference in New Issue
Block a user