Files
deepseek-harness/apps/desktop/electron-builder.config.d.mts
T
winewill ab62f09c22 fix(desktop): report Windows extraction failures with 7-Zip evidence
The installer showed "Failed to decompress files" and discarded 7-Zip's
error output, so a failure such as security software quarantining an
extracted file could not be told apart from a full disk or a broken
download.

- InstallerExtract returns negated Win32 errors for launch failures so
  they no longer collide with 7-Zip exit codes; 7-Zip writes UTF-8 errors.
- window-frame.dll composes a report (result, archive, destination,
  Windows version, full 7-Zip output), saves it under the updater cache
  directory, and presents a task dialog with the first error line, a
  collapsible bounded excerpt, and a Copy error details button. Silent
  installs keep only the report; a missing task dialog falls back to a
  message box.
- Unsigned Windows builds name their installer *-unsigned.exe so a
  shared file cannot pass for a release artifact; version discovery
  still counts them.
- The directory smoke asserts the saved report on a broken archive and
  smoke-windows.ps1 accepts the prepared DLL.

Refs #4893
2026-09-22 12:38:05 +08:00

80 lines
3.1 KiB
TypeScript

import type { AfterPackContext, BeforePackContext } from 'app-builder-lib'
/** Electron-builder fields asserted by the Desktop release tests. */
export interface DesktopElectronBuilderConfig {
readonly appId: string
readonly artifactName: string
readonly protocols: readonly [{ readonly name: 'DeepSeek Harness'; readonly schemes: readonly ['dsh'] }]
readonly directories: {
readonly output: string
}
readonly files: readonly [
string,
string,
string,
string,
{ readonly from: string, readonly to: 'dsh', readonly filter: readonly ['**/*'] },
{ readonly from: string, readonly to: 'dsh/node_modules', readonly filter: readonly ['**/*'] },
]
readonly extraMetadata: { readonly dshDesktopAppId: string }
readonly asarUnpack: readonly string[]
readonly extraResources: readonly [
{ readonly from: string, readonly to: 'runtime' },
{ readonly from: string, readonly to: 'icon.png' },
]
readonly mac: {
readonly extendInfo: { readonly NSMicrophoneUsageDescription: string }
readonly identity: string | undefined
readonly forceCodeSigning: boolean
readonly notarize: boolean
readonly signIgnore: readonly string[]
}
readonly dmg: {
readonly sign: boolean
readonly writeUpdateInfo: boolean
}
readonly win: {
readonly forceCodeSigning: boolean
readonly signtoolOptions: {
readonly publisherName: string | undefined
readonly sign: ((configuration: { path: string, hash: string, isNest: boolean }) => Promise<void>) | undefined
readonly signingHashAlgorithms: readonly string[]
}
}
readonly nsis: {
readonly include: string
readonly oneClick: false
readonly perMachine: false
readonly allowElevation: false
readonly allowToChangeInstallationDirectory: false
readonly installerLanguages: readonly ['en_US', 'zh_CN']
}
readonly beforeBuild: () => Promise<boolean>
readonly beforePack: (context: BeforePackContext) => Promise<void>
readonly afterPack: (context: AfterPackContext) => Promise<void>
readonly afterSign: (context: AfterPackContext) => Promise<void>
readonly artifactBuildCompleted: (artifact: { readonly file: string }) => Promise<void> | undefined
readonly publish: readonly [{ readonly provider: 'generic', readonly url: string }] | null
}
/**
* Create electron-builder configuration from one release environment.
* @param env - Packaging environment.
* @param hostPlatform - Build-host platform used when no explicit target is present.
* @param hostArch - Build-host architecture used when no explicit target is present.
* @param preparedRuntime - Verified private qualification runtime; ordinary releases use target-owned resources.
* @param preparedRuntimeVersion - Version that private runtime declares, which qualification rewrites away from the product version.
* @returns electron-builder configuration.
*/
export function createElectronBuilderConfig(
env?: NodeJS.ProcessEnv,
hostPlatform?: NodeJS.Platform,
hostArch?: string,
preparedRuntime?: string,
preparedRuntimeVersion?: string,
): DesktopElectronBuilderConfig
declare const electronBuilderConfig: DesktopElectronBuilderConfig
export default electronBuilderConfig