mirror of
https://github.com/deepseek-ai/deepseek-harness.git
synced 2026-09-11 04:00:38 +00:00
110 lines
3.8 KiB
JavaScript
110 lines
3.8 KiB
JavaScript
import {
|
|
resolveDesktopAppId,
|
|
resolveMacOSNotarizationEnvironment,
|
|
resolveMacOSSigningEnvironment,
|
|
} from './scripts/desktop-release-environment.mjs'
|
|
import { notarizeMacOSDiskImageArtifact } from './scripts/notarize-macos-disk-images.mjs'
|
|
import { verifyMacOSSignatureAfterSign } from './scripts/verify-macos-signature.mjs'
|
|
import {
|
|
createWindowsTokenSigner,
|
|
installWindowsNsisBootstrapSigner,
|
|
} from './scripts/windows-sign.mjs'
|
|
import { resolveDesktopAutoUpdateConfig } from './scripts/desktop-auto-update-environment.mjs'
|
|
import { desktopTargetBuildPaths } from './scripts/desktop-build-paths.mjs'
|
|
|
|
/**
|
|
* Create electron-builder configuration from one release environment.
|
|
* @param {NodeJS.ProcessEnv} env - Packaging environment.
|
|
* @param {NodeJS.Platform} hostPlatform - Build-host platform used when no explicit target is present.
|
|
* @param {string} hostArch - Build-host architecture used when no explicit target is present.
|
|
* @returns {object} electron-builder configuration.
|
|
*/
|
|
export function createElectronBuilderConfig(
|
|
env = process.env,
|
|
hostPlatform = process.platform,
|
|
hostArch = process.arch,
|
|
) {
|
|
const appId = resolveDesktopAppId(env)
|
|
const targetPlatform = env.DSH_DESKTOP_TARGET_PLATFORM
|
|
const resolvedPlatform = targetPlatform ?? hostPlatform
|
|
const resolvedArch = env.DSH_DESKTOP_TARGET_ARCH ?? hostArch
|
|
const packagesMacOS = targetPlatform === 'darwin' || (targetPlatform === undefined && hostPlatform === 'darwin')
|
|
const packagesWindows = targetPlatform === 'win32'
|
|
const macOSSigning = packagesMacOS ? resolveMacOSSigningEnvironment(env) : undefined
|
|
if (packagesMacOS) resolveMacOSNotarizationEnvironment(env)
|
|
const windowsSigner = packagesWindows
|
|
? createWindowsTokenSigner({
|
|
certificateFile: env.DSH_DESKTOP_WINDOWS_CER_FILE,
|
|
signTool: env.DSH_DESKTOP_WINDOWS_SIGNTOOL,
|
|
tokenPin: env.DSH_DESKTOP_WINDOWS_TOKEN_PIN,
|
|
keyContainer: env.DSH_DESKTOP_WINDOWS_KEY_CONTAINER,
|
|
})
|
|
: undefined
|
|
if (windowsSigner !== undefined) {
|
|
installWindowsNsisBootstrapSigner({ sign: windowsSigner })
|
|
}
|
|
const update = resolveDesktopAutoUpdateConfig(env, resolvedPlatform, resolvedArch)
|
|
const buildPaths = desktopTargetBuildPaths(update.target)
|
|
return {
|
|
appId,
|
|
productName: 'DeepSeek Harness',
|
|
artifactName: 'deepseek-harness-${version}-${os}-${arch}.${ext}',
|
|
directories: { output: buildPaths.artifacts },
|
|
asar: true,
|
|
files: [
|
|
'lib/*.js',
|
|
'lib/*.cjs',
|
|
'renderer/**/*',
|
|
'package.json',
|
|
],
|
|
extraResources: [
|
|
{ from: buildPaths.runtime, to: 'runtime' },
|
|
{ from: buildPaths.seed, to: 'seed' },
|
|
],
|
|
mac: {
|
|
category: 'public.app-category.developer-tools',
|
|
identity: macOSSigning?.signingIdentity,
|
|
forceCodeSigning: true,
|
|
hardenedRuntime: true,
|
|
notarize: true,
|
|
target: ['dmg', 'zip'],
|
|
},
|
|
dmg: {
|
|
sign: true,
|
|
writeUpdateInfo: false,
|
|
},
|
|
afterSign: context => {
|
|
if (context.electronPlatformName !== 'darwin') return
|
|
verifyMacOSSignatureAfterSign(context, macOSSigning ?? resolveMacOSSigningEnvironment(env))
|
|
},
|
|
artifactBuildCompleted: artifact => {
|
|
if (!artifact.file.endsWith('.dmg')) return
|
|
return notarizeMacOSDiskImageArtifact(
|
|
artifact,
|
|
env,
|
|
macOSSigning ?? resolveMacOSSigningEnvironment(env),
|
|
)
|
|
},
|
|
win: {
|
|
forceCodeSigning: true,
|
|
signtoolOptions: {
|
|
sign: windowsSigner,
|
|
signingHashAlgorithms: ['sha256'],
|
|
},
|
|
target: ['nsis'],
|
|
},
|
|
linux: {
|
|
category: 'Development',
|
|
target: ['AppImage'],
|
|
},
|
|
nsis: {
|
|
oneClick: false,
|
|
allowToChangeInstallationDirectory: true,
|
|
differentialPackage: true,
|
|
},
|
|
publish: [{ provider: 'generic', url: update.publicUrl }],
|
|
}
|
|
}
|
|
|
|
export default createElectronBuilderConfig()
|