electron-builder.config.d.mts 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. /** Electron-builder fields asserted by the Desktop release tests. */
  2. export interface DesktopElectronBuilderConfig {
  3. readonly appId: string
  4. readonly directories: {
  5. readonly output: string
  6. }
  7. readonly files: readonly [
  8. string,
  9. string,
  10. string,
  11. string,
  12. { readonly from: string, readonly to: 'dsh', readonly filter: readonly ['**/*'] },
  13. { readonly from: string, readonly to: 'dsh/node_modules', readonly filter: readonly ['**/*'] },
  14. ]
  15. readonly asarUnpack: readonly string[]
  16. readonly extraResources: readonly [{ readonly from: string, readonly to: 'runtime' }]
  17. readonly mac: {
  18. readonly identity: string | undefined
  19. readonly forceCodeSigning: boolean
  20. readonly notarize: boolean
  21. readonly signIgnore: readonly string[]
  22. }
  23. readonly dmg: {
  24. readonly sign: boolean
  25. readonly writeUpdateInfo: boolean
  26. }
  27. readonly nsis: {
  28. readonly include: string
  29. readonly oneClick: false
  30. readonly perMachine: false
  31. readonly allowElevation: false
  32. readonly allowToChangeInstallationDirectory: false
  33. readonly installerLanguages: readonly ['en_US', 'zh_CN']
  34. }
  35. readonly beforeBuild: () => Promise<boolean>
  36. readonly artifactBuildCompleted: (artifact: { readonly file: string }) => Promise<void> | undefined
  37. readonly publish: readonly [{ readonly provider: 'generic', readonly url: string }] | null
  38. }
  39. /**
  40. * Create electron-builder configuration from one release environment.
  41. * @param env - Packaging environment.
  42. * @param hostPlatform - Build-host platform used when no explicit target is present.
  43. * @param hostArch - Build-host architecture used when no explicit target is present.
  44. * @returns electron-builder configuration.
  45. */
  46. export function createElectronBuilderConfig(
  47. env?: NodeJS.ProcessEnv,
  48. hostPlatform?: NodeJS.Platform,
  49. hostArch?: string,
  50. ): DesktopElectronBuilderConfig
  51. declare const electronBuilderConfig: DesktopElectronBuilderConfig
  52. export default electronBuilderConfig