chore: 修改打包配置

This commit is contained in:
Wxw-Gu committed 2026-11-09 16:34:20 +08:00
1 parent f47af8024f
commit 6cadcb9a5a
7 files changed
+136 -47

No files matched your search

+32 -1
View File
@@ -32,6 +32,13 @@ const { createBuilderConfig } = nodeRequire('../../scripts/build-macos-edition.c
dmg: { artifactName: string }
}
}
const { resolveEditionRoots, validateLicenseStatusRoute } = nodeRequire('../../scripts/prepare-macos-edition.cjs') as {
resolveEditionRoots: (projectRoot?: string, env?: NodeJS.ProcessEnv) => {
stageRoot: string
outputRoot: string
}
validateLicenseStatusRoute: (hostPath: string) => void
}
const {
validateAsarRuntimeDependencies,
validateFfmpegRuntime,
@@ -294,7 +301,7 @@ describe('production runtime packaging', () => {
(item) => typeof item === 'string' && !item.startsWith('!') && item.includes('resources')
)
).toBe(false)
expect(config.dmg.artifactName).toBe('TraceMemo-2.5.2-mac-arm64-public.dmg')
expect(config.dmg.artifactName).toBe('TraceMemo-2.5.2-mac-arm64-oss.dmg')
const nativeConfig = createBuilderConfig({
edition: 'native',
stageRoot: join(root, 'mac-staging', 'native'),
@@ -305,6 +312,30 @@ describe('production runtime packaging', () => {
expect(nativeConfig.dmg.artifactName).toBe('TraceMemo-2.5.2-mac-arm64-native.dmg')
})
it('supports isolated macOS staging and output roots without changing defaults', () => {
expect(resolveEditionRoots('/repo', {})).toEqual({
stageRoot: '/repo/build/mac-staging',
outputRoot: '/repo/dist/mac'
})
expect(
resolveEditionRoots('/repo', {
TRACEMEMO_MAC_STAGE_ROOT: '/tmp/candidate/staging',
TRACEMEMO_MAC_OUTPUT_ROOT: '/tmp/candidate/output'
})
).toEqual({
stageRoot: '/tmp/candidate/staging',
outputRoot: '/tmp/candidate/output'
})
})
it('rejects a native Host that cannot serve the license status route', () => {
const host = join(root, 'license-route-host')
writeFileSync(host, 'GET /healthz')
expect(() => validateLicenseStatusRoute(host)).toThrow(/GET \/license\/status/)
writeFileSync(host, 'GET /healthz GET /license/status')
expect(() => validateLicenseStatusRoute(host)).not.toThrow()
})
it('requires the matching Windows and macOS sherpa native runtime', () => {
const resources = join(root, 'sherpa-resources')
const unpacked = join(resources, 'app.asar.unpacked', 'node_modules')