Options
All
  • Public
  • Public/Protected
  • All
Menu

Namespace electronPackager

Callable

  • electronPackager(opts: Options): Promise<string[]>
  • Bundles Electron-based application source code with a renamed/customized Electron executable and its supporting files into folders ready for distribution.

    Briefly, this function:

    • finds or downloads the correct release of Electron
    • uses that version of Electron to create a app in <out>/<appname>-<platform>-<arch>

    Short example:

    const packager = require('electron-packager')
    
    async function bundleElectronApp(options) {
      const appPaths = await packager(options)
      console.log(`Electron app bundles created:\n${appPaths.join("\n")}`)
    }

    Parameters

    • opts: Options

      Options to configure packaging.

    Returns Promise<string[]>

    A Promise containing the paths to the newly created application bundles.

Index

Type aliases

ArchOption

ArchOption: TargetArch | "all"

HookFunction

HookFunction: (buildPath: string, electronVersion: string, platform: TargetArch, arch: TargetArch, callback: () => void) => void

A function that is called on the completion of a packaging stage.

By default, the functions are called in parallel (via Promise.all). If you need the functions called serially, there is a utility function provided. Please note that callback-style functions are not supported by serialHooks. For example:

const packager = require('electron-packager')
const { serialHooks } = require('electron-packager/src/hooks')

packager({
  // ...
  afterCopy: [serialHooks([
    (buildPath, electronVersion, platform, arch) => {
      return new Promise((resolve, reject) => {
        setTimeout(() => {
          console.log('first function')
          resolve()
        }, 1000)
      })
    },
    (buildPath, electronVersion, platform, arch) => {
      console.log('second function')
    }
  ])],
  // ...
})

Type declaration

    • (buildPath: string, electronVersion: string, platform: TargetArch, arch: TargetArch, callback: () => void): void
    • Parameters

      • buildPath: string

        For afterExtract, the path to the temporary folder where the prebuilt Electron binary has been extracted to. For afterCopy and afterPrune, the path to the folder where the Electron app has been copied to.

      • electronVersion: string

        the version of Electron that is being bundled with the application.

      • platform: TargetArch

        The target platform you are packaging for.

      • arch: TargetArch

        The target architecture you are packaging for.

      • callback: () => void

        Must be called once you have completed your actions.

          • (): void
          • Must be called once you have completed your actions.

            Returns void

      Returns void

IgnoreFunction

IgnoreFunction: (path: string) => boolean

A predicate function that, given an absolute file path, returns true if the file should be ignored, or false if the file should be kept. This does not use any of the default ignored files/directories listed for the ignore option.

Type declaration

    • (path: string): boolean
    • Parameters

      • path: string

      Returns boolean

OfficialArch

OfficialArch: "ia32" | "x64" | "armv7l" | "arm64" | "mips64el"

Architectures that have been supported by the official Electron prebuilt binaries, past and present.

OfficialPlatform

OfficialPlatform: "linux" | "win32" | "darwin" | "mas"

Platforms that have been supported by the official Electron prebuilt binaries, past and present.

OsxNotarizeOptions

OsxNotarizeOptions: NotarizeCredentials & NotarizeTransporterOptions

See the documentation for electron-notarize for details.

OsxSignOptions

OsxSignOptions: Omit<SignOptions, "app" | "binaries" | "platform" | "version">

See the documentation for electron-osx-sign for details.

PlatformOption

PlatformOption: TargetPlatform | "all"

TargetArch

TargetArch: OfficialArch | string

TargetPlatform

TargetPlatform: OfficialPlatform | string

Generated using TypeDoc