mirror of
https://github.com/ILoveBingLu/CipherTalk.git
synced 2026-05-18 10:18:52 +08:00
Tighten mac packaging outputs
This commit is contained in:
@@ -96,6 +96,29 @@ function getFiles(buildTarget) {
|
||||
)
|
||||
}
|
||||
|
||||
if (buildTarget === 'mac') {
|
||||
return appendUnique(
|
||||
withoutItems(baseFiles, [
|
||||
'node_modules/koffi/build/**/*',
|
||||
'!node_modules/sherpa-onnx-node/bin/!(win-x64)/**/*',
|
||||
'!node_modules/ffmpeg-static/bin/!(win32-x64)/**/*'
|
||||
]),
|
||||
[
|
||||
...commonFiles,
|
||||
'!node_modules/onnxruntime-node/bin/**/linux/**/*',
|
||||
'!node_modules/onnxruntime-node/bin/**/win32/**/*',
|
||||
'node_modules/onnxruntime-node/bin/**/darwin/**/*',
|
||||
'!node_modules/sherpa-onnx-win-*/**/*',
|
||||
'!node_modules/sherpa-onnx-linux-*/**/*',
|
||||
'node_modules/sherpa-onnx-darwin-*/**/*',
|
||||
'!node_modules/sherpa-onnx-node/node_modules/sherpa-onnx-win-*/**/*',
|
||||
'!node_modules/sherpa-onnx-node/node_modules/sherpa-onnx-linux-*/**/*',
|
||||
'node_modules/sherpa-onnx-node/node_modules/sherpa-onnx-darwin-*/**/*',
|
||||
'node_modules/koffi/build/koffi/darwin_*/**/*'
|
||||
]
|
||||
)
|
||||
}
|
||||
|
||||
return appendUnique(baseFiles, commonFiles)
|
||||
}
|
||||
|
||||
@@ -109,6 +132,13 @@ function getAsarUnpack(buildTarget) {
|
||||
)
|
||||
}
|
||||
|
||||
if (buildTarget === 'mac') {
|
||||
return appendUnique(
|
||||
withoutItems(baseAsarUnpack, ['node_modules/koffi/**/*']),
|
||||
['node_modules/koffi/build/koffi/darwin_*/**/*']
|
||||
)
|
||||
}
|
||||
|
||||
return baseAsarUnpack
|
||||
}
|
||||
|
||||
|
||||
@@ -13,6 +13,26 @@ if (!target || !['win', 'mac'].includes(target)) {
|
||||
const cliPath = require.resolve('electron-builder/cli.js')
|
||||
const configPath = path.join(__dirname, 'electron-builder.config.cjs')
|
||||
|
||||
function cleanupBlockmapFiles(buildTarget) {
|
||||
if (buildTarget !== 'mac') {
|
||||
return
|
||||
}
|
||||
|
||||
const releaseDir = path.join(__dirname, '..', 'release')
|
||||
if (!fs.existsSync(releaseDir)) {
|
||||
return
|
||||
}
|
||||
|
||||
for (const name of fs.readdirSync(releaseDir)) {
|
||||
if (!name.endsWith('.dmg.blockmap')) {
|
||||
continue
|
||||
}
|
||||
|
||||
fs.rmSync(path.join(releaseDir, name), { force: true })
|
||||
console.log(`🧹 Removed obsolete blockmap: ${name}`)
|
||||
}
|
||||
}
|
||||
|
||||
const result = spawnSync(
|
||||
process.execPath,
|
||||
[cliPath, `--${target}`, '--publish', 'never', '--config', configPath],
|
||||
@@ -33,3 +53,5 @@ const artifactName = target === 'mac'
|
||||
if (!fs.existsSync(path.join(__dirname, '..', artifactName))) {
|
||||
process.exit(result.status || 1)
|
||||
}
|
||||
|
||||
cleanupBlockmapFiles(target)
|
||||
|
||||
Reference in New Issue
Block a user