mirror of
https://wget.la/https://github.com/Wxw-Gu/WechatExplorer
synced 2026-08-18 03:57:02 +08:00
fix: 修复 macOS 打包版 WCDB 初始化
This commit is contained in:
+11
-6
@@ -1,5 +1,6 @@
|
|||||||
appId: com.electron.app
|
appId: com.wechatexplorer.app
|
||||||
productName: wechatexplorer
|
productName: WechatExplorer
|
||||||
|
afterPack: scripts/after-pack.cjs
|
||||||
directories:
|
directories:
|
||||||
buildResources: build
|
buildResources: build
|
||||||
files:
|
files:
|
||||||
@@ -29,10 +30,14 @@ nsis:
|
|||||||
mac:
|
mac:
|
||||||
entitlementsInherit: build/entitlements.mac.plist
|
entitlementsInherit: build/entitlements.mac.plist
|
||||||
extendInfo:
|
extendInfo:
|
||||||
- NSCameraUsageDescription: Application requests access to the device's camera.
|
# The bundled WCDB bridge accepts Electron as its internal host name. The
|
||||||
- NSMicrophoneUsageDescription: Application requests access to the device's microphone.
|
# public app name and bundle identifier remain WechatExplorer-specific.
|
||||||
- NSDocumentsFolderUsageDescription: Application requests access to the user's Documents folder.
|
CFBundleName: Electron
|
||||||
- NSDownloadsFolderUsageDescription: Application requests access to the user's Downloads folder.
|
CFBundleDisplayName: WechatExplorer
|
||||||
|
NSCameraUsageDescription: Application requests access to the device's camera.
|
||||||
|
NSMicrophoneUsageDescription: Application requests access to the device's microphone.
|
||||||
|
NSDocumentsFolderUsageDescription: Application requests access to the user's Documents folder.
|
||||||
|
NSDownloadsFolderUsageDescription: Application requests access to the user's Downloads folder.
|
||||||
notarize: false
|
notarize: false
|
||||||
dmg:
|
dmg:
|
||||||
artifactName: ${name}-${version}.${ext}
|
artifactName: ${name}-${version}.${ext}
|
||||||
|
|||||||
+7
-16
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "wechatexplorer",
|
"name": "wechatexplorer",
|
||||||
"version": "2.0.0",
|
"version": "2.0.1",
|
||||||
"description": "mac 版本获取微信聊天记录, AI群聊总结助手",
|
"description": "mac 版本获取微信聊天记录, AI群聊总结助手",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"wechat",
|
"wechat",
|
||||||
@@ -21,12 +21,12 @@
|
|||||||
"dev": "electron-vite dev",
|
"dev": "electron-vite dev",
|
||||||
"build": "npm run typecheck && electron-vite build",
|
"build": "npm run typecheck && electron-vite build",
|
||||||
"postinstall": "electron-builder install-app-deps",
|
"postinstall": "electron-builder install-app-deps",
|
||||||
"build:unpack": "npm run build && electron-builder --dir",
|
"build:unpack": "npm run build && electron-builder --config electron-builder.yml --dir",
|
||||||
"build:win": "npm run build && electron-builder --win",
|
"build:win": "npm run build && electron-builder --config electron-builder.yml --win",
|
||||||
"build:mac:x64": "electron-vite build && electron-builder --mac --x64",
|
"build:mac:x64": "electron-vite build && electron-builder --config electron-builder.yml --mac --x64",
|
||||||
"build:mac:arm64": "electron-vite build && electron-builder --mac --arm64",
|
"build:mac:arm64": "electron-vite build && electron-builder --config electron-builder.yml --mac --arm64",
|
||||||
"release:mac": "electron-vite build && electron-builder --mac --x64 --arm64 --publish always",
|
"release:mac": "electron-vite build && electron-builder --config electron-builder.yml --mac --x64 --arm64 --publish always",
|
||||||
"build:linux": "electron-vite build && electron-builder --linux"
|
"build:linux": "electron-vite build && electron-builder --config electron-builder.yml --linux"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@electron-toolkit/preload": "^3.0.2",
|
"@electron-toolkit/preload": "^3.0.2",
|
||||||
@@ -66,14 +66,5 @@
|
|||||||
"electron",
|
"electron",
|
||||||
"esbuild"
|
"esbuild"
|
||||||
]
|
]
|
||||||
},
|
|
||||||
"build": {
|
|
||||||
"artifactName": "${productName}-${version}-${os}-${arch}.${ext}",
|
|
||||||
"mac": {
|
|
||||||
"target": [
|
|
||||||
"dmg",
|
|
||||||
"zip"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,54 @@
|
|||||||
|
const { existsSync, renameSync } = require('node:fs')
|
||||||
|
const { execFileSync } = require('node:child_process')
|
||||||
|
const path = require('node:path')
|
||||||
|
|
||||||
|
const COMPATIBILITY_NAME = 'Electron'
|
||||||
|
const HELPER_SUFFIXES = ['', ' (Plugin)', ' (Renderer)', ' (GPU)']
|
||||||
|
|
||||||
|
function setPlistValue(plistPath, key, value) {
|
||||||
|
execFileSync('/usr/libexec/PlistBuddy', ['-c', `Set :${key} ${value}`, plistPath])
|
||||||
|
}
|
||||||
|
|
||||||
|
exports.default = async function afterPack(context) {
|
||||||
|
if (context.electronPlatformName !== 'darwin') return
|
||||||
|
|
||||||
|
const productName = context.packager.appInfo.productFilename
|
||||||
|
const appPath = path.join(context.appOutDir, `${productName}.app`)
|
||||||
|
const contentsPath = path.join(appPath, 'Contents')
|
||||||
|
const sourceExecutable = path.join(contentsPath, 'MacOS', productName)
|
||||||
|
const targetExecutable = path.join(contentsPath, 'MacOS', COMPATIBILITY_NAME)
|
||||||
|
|
||||||
|
if (existsSync(sourceExecutable)) renameSync(sourceExecutable, targetExecutable)
|
||||||
|
if (!existsSync(targetExecutable)) {
|
||||||
|
throw new Error(`Missing Electron main executable: ${sourceExecutable}`)
|
||||||
|
}
|
||||||
|
|
||||||
|
const appPlistPath = path.join(contentsPath, 'Info.plist')
|
||||||
|
setPlistValue(appPlistPath, 'CFBundleExecutable', COMPATIBILITY_NAME)
|
||||||
|
setPlistValue(appPlistPath, 'CFBundleName', COMPATIBILITY_NAME)
|
||||||
|
|
||||||
|
const frameworksPath = path.join(contentsPath, 'Frameworks')
|
||||||
|
|
||||||
|
for (const suffix of HELPER_SUFFIXES) {
|
||||||
|
const sourceName = `${productName} Helper${suffix}`
|
||||||
|
const targetName = `${COMPATIBILITY_NAME} Helper${suffix}`
|
||||||
|
const sourceBundle = path.join(frameworksPath, `${sourceName}.app`)
|
||||||
|
const targetBundle = path.join(frameworksPath, `${targetName}.app`)
|
||||||
|
|
||||||
|
if (existsSync(sourceBundle)) renameSync(sourceBundle, targetBundle)
|
||||||
|
if (!existsSync(targetBundle)) {
|
||||||
|
throw new Error(`Missing Electron helper bundle: ${sourceBundle}`)
|
||||||
|
}
|
||||||
|
|
||||||
|
const sourceExecutable = path.join(targetBundle, 'Contents', 'MacOS', sourceName)
|
||||||
|
const targetExecutable = path.join(targetBundle, 'Contents', 'MacOS', targetName)
|
||||||
|
if (existsSync(sourceExecutable)) renameSync(sourceExecutable, targetExecutable)
|
||||||
|
if (!existsSync(targetExecutable)) {
|
||||||
|
throw new Error(`Missing Electron helper executable: ${sourceExecutable}`)
|
||||||
|
}
|
||||||
|
|
||||||
|
const plistPath = path.join(targetBundle, 'Contents', 'Info.plist')
|
||||||
|
setPlistValue(plistPath, 'CFBundleExecutable', targetName)
|
||||||
|
setPlistValue(plistPath, 'CFBundleName', targetName)
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user