🎩 You're Invited:Meet the Socket team at Black Hat in Las Vegas, August 3-6.RSVP
Sign In

electron-packager

Package Overview
Dependencies
Maintainers
5
Versions
96
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

electron-packager - npm Package Compare versions

Comparing version
17.0.0
to
17.1.0
+5
-0
NEWS.md

@@ -7,2 +7,7 @@ # Electron Packager: Changes by Version

### Changed
* Replaced `electron-notarize` with `@electron/notarize`. The configuration options are unchanged. This migration is purely cosmetic.
* Added new `afterFinalizePackageTargets` hook. This hook exposes the platform/arch combinations that are being packaged when the `arch:all` or `platform:all` options are set.
## [17.0.0]

@@ -9,0 +14,0 @@

+2
-2
{
"name": "electron-packager",
"version": "17.0.0",
"version": "17.1.0",
"description": "Customize and package your Electron app with OS-specific bundles (.app, .exe, etc.) via JS or CLI",

@@ -31,2 +31,3 @@ "main": "src/index.js",

"@electron/get": "^2.0.0",
"@electron/notarize": "^1.2.3",
"@electron/osx-sign": "^1.0.1",

@@ -36,3 +37,2 @@ "@electron/universal": "^1.3.2",

"debug": "^4.0.1",
"electron-notarize": "^1.1.1",
"extract-zip": "^2.0.0",

@@ -39,0 +39,0 @@ "filenamify": "^4.1.0",

@@ -17,3 +17,3 @@ // Originally based on the type definitions for electron-packager 14.0

TransporterOptions
} from 'electron-notarize/lib/types';
} from '@electron/notarize/lib/types';
import { SignOptions } from '@electron/osx-sign/dist/esm/types';

@@ -110,3 +110,4 @@ import type { makeUniversalApp } from '@electron/universal';

* Electron binary has been extracted to. For [[afterCopy]] and [[afterPrune]], the path to the
* folder where the Electron app has been copied to.
* folder where the Electron app has been copied to. For [[afterComplete]], the final directory
* of the packaged application.
* @param electronVersion - the version of Electron that is being bundled with the application.

@@ -125,2 +126,8 @@ * @param platform - The target platform you are packaging for.

type TargetDefinition = {
arch: TargetArch;
platform: TargetPlatform;
}
type FinalizePackageTargetsHookFunction = (targets: TargetDefinition[], callback: (err?: Error | null) => void) => void;
/** See the documentation for [`@electron/osx-sign`](https://npm.im/@electron/osx-sign#opts) for details. */

@@ -130,3 +137,3 @@ type OsxSignOptions = Omit<SignOptions, 'app' | 'binaries' | 'platform' | 'version'>;

/**
* See the documentation for [`electron-notarize`](https://npm.im/electron-notarize#method-notarizeopts-promisevoid)
* See the documentation for [`@electron/notarize`](https://npm.im/@electron/notarize#method-notarizeopts-promisevoid)
* for details.

@@ -191,2 +198,10 @@ */

/**
* Functions to be called after your app directory has been packaged into an .asar file.
*
* **Note**: `afterAsar` will only be called if the [[asar]] option is set.
*/
afterAsar?: HookFunction[];
/** Functions to be called after the packaged application has been moved to the final directory. */
afterComplete?: HookFunction[];
/**
* Functions to be called after your app directory has been copied to a temporary directory.

@@ -197,5 +212,14 @@ *

afterCopy?: HookFunction[];
/**
* Functions to be called after the files specified in the [[extraResource]] option have been copied.
**/
afterCopyExtraResources?: HookFunction[];
/** Functions to be called after the prebuilt Electron binary has been extracted to a temporary directory. */
afterExtract?: HookFunction[];
/**
* Functions to be called after the final matrix of platform/arch combination is determined. Use this to
* learn what archs/platforms packager is targetting when you pass "all" as a value.
*/
afterFinalizePackageTargets?: FinalizePackageTargetsHookFunction[];
/**
* Functions to be called after Node module pruning has been applied to the application.

@@ -290,2 +314,18 @@ *

/**
* Functions to be called before your app directory is packaged into an .asar file.
*
* **Note**: `beforeAsar` will only be called if the [[asar]] option is set.
*/
beforeAsar?: HookFunction[];
/**
* Functions to be called before your app directory is copied to a temporary directory.
*
* **Note**: `beforeCopy` will not be called if the [[prebuiltAsar]] option is set.
*/
beforeCopy?: HookFunction[];
/**
* Functions to be called before the files specified in the [[extraResource]] option are copied.
**/
beforeCopyExtraResources?: HookFunction[];
/**
* The build version of the application. Defaults to the value of the [[appVersion]] option.

@@ -443,3 +483,3 @@ * Maps to the `FileVersion` metadata property on Windows, and `CFBundleVersion` on macOS.

* If present, notarizes macOS target apps when the host platform is macOS and XCode is installed.
* See [`electron-notarize`](https://github.com/electron/electron-notarize#method-notarizeopts-promisevoid)
* See [`@electron/notarize`](https://github.com/electron/notarize#method-notarizeopts-promisevoid)
* for option descriptions, such as how to use `appleIdPassword` safely or obtain an API key.

@@ -446,0 +486,0 @@ *

@@ -201,2 +201,3 @@ 'use strict'

await hooks.promisifyHooks(opts.afterFinalizePackageTargets, [targets.createPlatformArchPairs(opts, platforms, archs).map(([platform, arch]) => ({ platform, arch }))])
const appPaths = await packageAllSpecifiedCombos(opts, archs, platforms)

@@ -203,0 +204,0 @@ // Remove falsy entries (e.g. skipped platforms)

@@ -9,3 +9,3 @@ 'use strict'

const plist = require('plist')
const { notarize } = require('electron-notarize')
const { notarize } = require('@electron/notarize')
const { signApp } = require('@electron/osx-sign')

@@ -426,3 +426,3 @@

function createNotarizeOpts (properties, appBundleId, appPath, quiet) {
// osxNotarize options are handed off to the electron-notarize module, but with a few
// osxNotarize options are handed off to the @electron/notarize module, but with a few
// additions from the main options. The user may think they can pass bundle ID or appPath,

@@ -429,0 +429,0 @@ // but they will be ignored.

@@ -76,2 +76,17 @@ 'use strict'

get commonHookArgs () {
return [
this.opts.electronVersion,
this.opts.platform,
this.opts.arch
]
}
get hookArgsWithOriginalResourcesAppDir () {
return [
this.originalResourcesAppDir,
...this.commonHookArgs
]
}
async relativeRename (basePath, oldName, newName) {

@@ -111,2 +126,4 @@ debug(`Renaming ${oldName} to ${newName} in ${basePath}`)

}
await hooks.promisifyHooks(this.opts.afterInitialize, this.hookArgsWithOriginalResourcesAppDir)
}

@@ -121,8 +138,3 @@

async copyTemplate () {
const hookArgs = [
this.originalResourcesAppDir,
this.opts.electronVersion,
this.opts.platform,
this.opts.arch
]
await hooks.promisifyHooks(this.opts.beforeCopy, this.hookArgsWithOriginalResourcesAppDir)

@@ -133,5 +145,5 @@ await fs.copy(this.opts.dir, this.originalResourcesAppDir, {

})
await hooks.promisifyHooks(this.opts.afterCopy, hookArgs)
await hooks.promisifyHooks(this.opts.afterCopy, this.hookArgsWithOriginalResourcesAppDir)
if (this.opts.prune) {
await hooks.promisifyHooks(this.opts.afterPrune, hookArgs)
await hooks.promisifyHooks(this.opts.afterPrune, this.hookArgsWithOriginalResourcesAppDir)
}

@@ -178,3 +190,3 @@ }

for (const hookName of ['afterCopy', 'afterPrune']) {
for (const hookName of ['beforeCopy', 'afterCopy', 'afterPrune']) {
if (this.opts[hookName]) {

@@ -210,2 +222,5 @@ throw new Error(`${hookName} is incompatible with prebuiltAsar`)

debug(`Running asar with the options ${JSON.stringify(this.asarOptions)}`)
await hooks.promisifyHooks(this.opts.beforeAsar, this.hookArgsWithOriginalResourcesAppDir)
await asar.createPackageWithOptions(this.originalResourcesAppDir, this.appAsarPath, this.asarOptions)

@@ -220,2 +235,4 @@ const { headerString } = asar.getRawHeader(this.appAsarPath)

await fs.remove(this.originalResourcesAppDir)
await hooks.promisifyHooks(this.opts.afterAsar, this.hookArgsWithOriginalResourcesAppDir)
}

@@ -228,5 +245,14 @@

const hookArgs = [
this.stagingPath,
...this.commonHookArgs
]
await hooks.promisifyHooks(this.opts.beforeCopyExtraResources, hookArgs)
await Promise.all(extraResources.map(
resource => fs.copy(resource, path.resolve(this.stagingPath, this.resourcesDir, path.basename(resource)))
))
await hooks.promisifyHooks(this.opts.afterCopyExtraResources, hookArgs)
}

@@ -242,2 +268,11 @@

if (this.opts.afterComplete) {
const hookArgs = [
finalPath,
...this.commonHookArgs
]
await hooks.promisifyHooks(this.opts.afterComplete, hookArgs)
}
return finalPath

@@ -244,0 +279,0 @@ }

@@ -95,3 +95,3 @@ Usage: electron-packager <sourcedir> <appname> [options...]

--osx-notarize.appleId="foo@example.com"
For info on supported values see https://npm.im/electron-notarize#method-notarizeopts-promisevoid
For info on supported values see https://npm.im/@electron/notarize#method-notarizeopts-promisevoid
Properties supported include:

@@ -98,0 +98,0 @@ - appleId: should contain your apple ID username / email