mirror of
https://wget.la/https://github.com/Wxw-Gu/WechatExplorer
synced 2026-08-18 03:57:02 +08:00
chore: 修改windows打包报错
This commit is contained in:
@@ -88,7 +88,9 @@ function validateAsarRuntimeDependencies(runtimeResources) {
|
|||||||
const asarPath = path.join(runtimeResources, 'app.asar')
|
const asarPath = path.join(runtimeResources, 'app.asar')
|
||||||
if (!existsSync(asarPath)) throw new Error(`Missing packaged application archive: ${asarPath}`)
|
if (!existsSync(asarPath)) throw new Error(`Missing packaged application archive: ${asarPath}`)
|
||||||
|
|
||||||
const entries = new Set(asar.listPackage(asarPath))
|
// @electron/asar returns platform-native separators. Normalize to POSIX
|
||||||
|
// paths so validation behaves consistently on Windows and macOS/Linux.
|
||||||
|
const entries = new Set(asar.listPackage(asarPath).map((entry) => entry.replaceAll('\\', '/')))
|
||||||
const missingPackages = REQUIRED_RUNTIME_PACKAGES.filter(
|
const missingPackages = REQUIRED_RUNTIME_PACKAGES.filter(
|
||||||
(packageName) => !entries.has(`/node_modules/${packageName}/package.json`)
|
(packageName) => !entries.has(`/node_modules/${packageName}/package.json`)
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -71,6 +71,30 @@ describe('production runtime packaging', () => {
|
|||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
it('accepts runtime dependencies when asar uses Windows path separators', async () => {
|
||||||
|
const resources = join(root, 'asar-complete-resources')
|
||||||
|
const source = join(root, 'asar-complete-source')
|
||||||
|
const packages = [
|
||||||
|
'@electron-toolkit/preload',
|
||||||
|
'@electron-toolkit/utils',
|
||||||
|
'archiver',
|
||||||
|
'electron-updater',
|
||||||
|
'ffmpeg-static',
|
||||||
|
'fs-extra',
|
||||||
|
'jsonrepair',
|
||||||
|
'koffi'
|
||||||
|
]
|
||||||
|
for (const packageName of packages) {
|
||||||
|
const packagePath = join(source, 'node_modules', ...packageName.split('/'))
|
||||||
|
mkdirSync(packagePath, { recursive: true })
|
||||||
|
writeFileSync(join(packagePath, 'package.json'), '{}')
|
||||||
|
}
|
||||||
|
mkdirSync(resources, { recursive: true })
|
||||||
|
await asar.createPackage(source, join(resources, 'app.asar'))
|
||||||
|
|
||||||
|
expect(() => validateAsarRuntimeDependencies(resources)).not.toThrow()
|
||||||
|
})
|
||||||
|
|
||||||
it('requires and unpacks the bundled ffmpeg-static executable', () => {
|
it('requires and unpacks the bundled ffmpeg-static executable', () => {
|
||||||
const resources = join(root, 'ffmpeg-resources')
|
const resources = join(root, 'ffmpeg-resources')
|
||||||
const ffmpegPath = join(
|
const ffmpegPath = join(
|
||||||
|
|||||||
Reference in New Issue
Block a user