electron-packager
Advanced tools
Comparing version 15.2.0 to 15.3.0
@@ -17,3 +17,3 @@ # Frequently Asked Questions | ||
As stated in the documentation for [`ignore`](https://electron.github.io/electron-packager/master/interfaces/electronpackager.options.html#ignore), it uses "[one] or more additional | ||
As stated in the documentation for [`ignore`](https://electron.github.io/electron-packager/main/interfaces/electronpackager.options.html#ignore), it uses "[one] or more additional | ||
[regular expression](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions) | ||
@@ -48,5 +48,5 @@ patterns. […] Please note that [glob patterns](https://en.wikipedia.org/wiki/Glob_%28programming%29) | ||
The docs for [`icon`](https://electron.github.io/electron-packager/master/interfaces/electronpackager.options.html#icon) | ||
The docs for [`icon`](https://electron.github.io/electron-packager/main/interfaces/electronpackager.options.html#icon) | ||
already show how to set an icon on your `BrowserWindow`, but your dock/taskbar may not use that and | ||
instead use the `Icon` value in your `.desktop` file. The [Linux distributable creators](https://github.com/electron/electron-packager#distributable-creators) | ||
can help you set/distribute the appropriate icon in that case. |
14
NEWS.md
@@ -5,4 +5,14 @@ # Electron Packager: Changes by Version | ||
[Unreleased]: https://github.com/electron/electron-packager/compare/v15.2.0...master | ||
[Unreleased]: https://github.com/electron/electron-packager/compare/v15.3.0...main | ||
## [15.3.0] - 2021-07-17 | ||
[15.3.0]: https://github.com/electron/electron-packager/compare/v15.2.0...v15.3.0 | ||
### Added | ||
* Bundled app validation to ensure that both `package.json` and the main entry point exist (#1257) | ||
* Support for customizing Windows targets on darwin/arm64 (#1260) | ||
* Support for customizing Windows targets on WSL without Wine installed (#1260) | ||
## [15.2.0] - 2020-12-04 | ||
@@ -791,3 +801,3 @@ | ||
* [win32] `rcedit` dependency updated to 0.4.x. **A new DLL is required to run the new version | ||
of rcedit, please see [the documentation](https://github.com/electron/electron-packager/blob/master/README.md#building-windows-apps-from-non-windows-platforms) | ||
of rcedit, please see [the documentation](https://github.com/electron/electron-packager/blob/main/README.md#building-windows-apps-from-non-windows-platforms) | ||
for details** | ||
@@ -794,0 +804,0 @@ * API documentation moved from readme.md to docs/api.md (#296) |
{ | ||
"name": "electron-packager", | ||
"version": "15.2.0", | ||
"version": "15.3.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", | ||
"asar": "^3.0.0", | ||
"cross-spawn-windows-exe": "^1.2.0", | ||
"debug": "^4.0.1", | ||
@@ -43,3 +44,3 @@ "electron-notarize": "^1.0.0", | ||
"plist": "^3.0.0", | ||
"rcedit": "^2.0.0", | ||
"rcedit": "^3.0.1", | ||
"resolve": "^1.1.6", | ||
@@ -57,9 +58,9 @@ "semver": "^7.1.3", | ||
"eslint-config-standard": "^16.0.0", | ||
"eslint-plugin-ava": "^11.0.0", | ||
"eslint-plugin-ava": "^12.0.0", | ||
"eslint-plugin-import": "^2.22.1", | ||
"eslint-plugin-node": "^11.0.0", | ||
"eslint-plugin-promise": "^4.0.1", | ||
"eslint-plugin-promise": "^5.1.0", | ||
"nyc": "^15.0.0", | ||
"pkg-up": "^3.0.1", | ||
"sinon": "^9.0.0", | ||
"sinon": "^11.0.0", | ||
"tsd": "^0.14.0", | ||
@@ -66,0 +67,0 @@ "typedoc": "^0.19.0", |
@@ -5,6 +5,6 @@ # Electron Packager | ||
[![CircleCI Build Status](https://circleci.com/gh/electron/electron-packager/tree/master.svg?style=svg)](https://circleci.com/gh/electron/electron-packager/tree/master) | ||
[![Coverage Status](https://codecov.io/gh/electron/electron-packager/branch/master/graph/badge.svg)](https://codecov.io/gh/electron/electron-packager) | ||
[![CircleCI Build Status](https://circleci.com/gh/electron/electron-packager/tree/main.svg?style=svg)](https://circleci.com/gh/electron/electron-packager/tree/main) | ||
[![Coverage Status](https://codecov.io/gh/electron/electron-packager/branch/main/graph/badge.svg)](https://codecov.io/gh/electron/electron-packager) | ||
[![NPM](https://badgen.net/npm/v/electron-packager)](https://npm.im/electron-packager) | ||
![Dependabot Status](https://flat.badgen.net/dependabot/electron/electron-packager?icon=dependabot) | ||
[![Discord](https://img.shields.io/discord/745037351163527189?color=blueviolet&logo=discord)](https://discord.gg/electron) | ||
@@ -14,8 +14,8 @@ [Supported Platforms](#supported-platforms) | | ||
[Usage](#usage) | | ||
[API](https://electron.github.io/electron-packager/master/) | | ||
[Contributing](https://github.com/electron/electron-packager/blob/master/CONTRIBUTING.md) | | ||
[Support](https://github.com/electron/electron-packager/blob/master/SUPPORT.md) | | ||
[API](https://electron.github.io/electron-packager/main/) | | ||
[Contributing](https://github.com/electron/electron-packager/blob/main/CONTRIBUTING.md) | | ||
[Support](https://github.com/electron/electron-packager/blob/main/SUPPORT.md) | | ||
[Related Apps/Libraries](#related) | | ||
[FAQ](https://github.com/electron/electron-packager/blob/master/docs/faq.md) | | ||
[Release Notes](https://github.com/electron/electron-packager/blob/master/NEWS.md) | ||
[FAQ](https://github.com/electron/electron-packager/blob/main/docs/faq.md) | | ||
[Release Notes](https://github.com/electron/electron-packager/blob/main/NEWS.md) | ||
@@ -60,33 +60,35 @@ ---- | ||
```sh | ||
# For use in npm scripts (recommended) | ||
npm install electron-packager --save-dev | ||
# For use from the CLI | ||
npm install electron-packager -g | ||
npm install --save-dev electron-packager | ||
``` | ||
It is **not** recommended to install `electron-packager` globally. | ||
### Building Windows apps from non-Windows platforms | ||
Building an Electron app for the Windows target platform requires editing the `Electron.exe` file. | ||
Currently, Electron Packager uses [node-rcedit](https://github.com/atom/node-rcedit) to accomplish | ||
Currently, Electron Packager uses [`node-rcedit`](https://github.com/atom/node-rcedit) to accomplish | ||
this. A Windows executable is bundled in that Node package and needs to be run in order for this | ||
functionality to work, so on non-Windows host platforms, [Wine](https://www.winehq.org/) 1.6 or | ||
later needs to be installed. On macOS, it is installable via [Homebrew](http://brew.sh/). | ||
functionality to work, so on non-Windows host platforms (not including WSL), | ||
[Wine](https://www.winehq.org/) 1.6 or later needs to be installed. On macOS, it is installable | ||
via [Homebrew](http://brew.sh/). | ||
## Usage | ||
JavaScript API usage can be found in the [API documentation](https://electron.github.io/electron-packager/master/modules/electronpackager.html). | ||
JavaScript API usage can be found in the [API documentation](https://electron.github.io/electron-packager/main/modules/electronpackager.html). | ||
### From the Command Line | ||
Running electron-packager from the command line has this basic form: | ||
Running Electron Packager from the command line has this basic form: | ||
``` | ||
electron-packager <sourcedir> <appname> --platform=<platform> --arch=<arch> [optional flags...] | ||
npx electron-packager <sourcedir> <appname> --platform=<platform> --arch=<arch> [optional flags...] | ||
``` | ||
**Note**: `npx` can be substituted for `yarn` or `npm exec` depending on what package manager and | ||
the version you have installed. | ||
This will: | ||
- Find or download the correct release of Electron | ||
- Use that version of Electron to create a app in `<out>/<appname>-<platform>-<arch>` *(this can be customized via an optional flag)* | ||
- Use that version of Electron to create an app in `<out>/<appname>-<platform>-<arch>` *(this can be customized via an optional flag)* | ||
@@ -100,4 +102,4 @@ `--platform` and `--arch` can be omitted, in two cases: | ||
For an overview of the other optional flags, run `electron-packager --help` or see | ||
[usage.txt](https://github.com/electron/electron-packager/blob/master/usage.txt). For | ||
detailed descriptions, see the [API documentation](https://electron.github.io/electron-packager/master/modules/electronpackager.html). | ||
[usage.txt](https://github.com/electron/electron-packager/blob/main/usage.txt). For | ||
detailed descriptions, see the [API documentation](https://electron.github.io/electron-packager/main/modules/electronpackager.html). | ||
@@ -133,3 +135,3 @@ If `appname` is omitted, this will use the name specified by "productName" or "name" in the nearest package.json. | ||
* `electron-packager` is installed globally | ||
* `electron-packager` is installed locally | ||
* `productName` in `package.json` has been set to `Foo Bar` | ||
@@ -142,3 +144,3 @@ * The `electron` module is in the `devDependencies` section of `package.json`, and set to the exact version of `1.4.15`. | ||
``` | ||
electron-packager . | ||
npx electron-packager . | ||
``` | ||
@@ -206,6 +208,6 @@ | ||
- [electron-packager-languages](https://npm.im/electron-packager-languages) - set the locales | ||
- [electron-packager-languages](https://npm.im/electron-packager-languages) - sets the locales | ||
available to Electron when packaged, which is used by the Mac App Store, among other places | ||
- [electron-packager-plugin-non-proprietary-codecs-ffmpeg](https://www.npmjs.com/package/electron-packager-plugin-non-proprietary-codecs-ffmpeg) - replaces the normal version of FFmpeg in Electron with a version without proprietary codecs | ||
- [electron-rebuild](https://github.com/electron/electron-rebuild) - rebuild native Node.js modules | ||
- [electron-rebuild](https://github.com/electron/electron-rebuild) - rebuilds native Node.js modules | ||
against the packaged Electron version |
'use strict' | ||
const debug = require('debug')('electron-packager') | ||
const filenamify = require('filenamify') | ||
const fs = require('fs-extra') | ||
const metadata = require('../package.json') | ||
@@ -88,3 +90,33 @@ const os = require('os') | ||
}, | ||
/** | ||
* Validates that the application directory contains a package.json file, and that there exists an | ||
* appropriate main entry point file, per the rules of the "main" field in package.json. | ||
* | ||
* See: https://docs.npmjs.com/cli/v6/configuring-npm/package-json#main | ||
* | ||
* @param appDir - the directory specified by the user | ||
* @param bundledAppDir - the directory where the appDir is copied to in the bundled Electron app | ||
*/ | ||
validateElectronApp: async function validateElectronApp (appDir, bundledAppDir) { | ||
debug('Validating bundled Electron app') | ||
debug('Checking for a package.json file') | ||
const bundledPackageJSONPath = path.join(bundledAppDir, 'package.json') | ||
if (!(await fs.pathExists(bundledPackageJSONPath))) { | ||
const originalPackageJSONPath = path.join(appDir, 'package.json') | ||
throw new Error(`Application manifest was not found. Make sure "${originalPackageJSONPath}" exists and does not get ignored by your ignore option`) | ||
} | ||
debug('Checking for the main entry point file') | ||
const packageJSON = await fs.readJson(bundledPackageJSONPath) | ||
const mainScriptBasename = packageJSON.main || 'index.js' | ||
const mainScript = path.resolve(bundledAppDir, mainScriptBasename) | ||
if (!(await fs.pathExists(mainScript))) { | ||
const originalMainScript = path.join(appDir, mainScriptBasename) | ||
throw new Error(`The main entry point to your app was not found. Make sure "${originalMainScript}" exists and does not get ignored by your ignore option`) | ||
} | ||
debug('Validation complete') | ||
}, | ||
hostInfo: function hostInfo () { | ||
@@ -91,0 +123,0 @@ return `Electron Packager ${metadata.version}\n` + |
@@ -242,4 +242,4 @@ // Originally based on the type definitions for electron-packager 14.0 | ||
* archive format](https://github.com/electron/asar). Reasons why you may want to enable | ||
* this feature are described in [an application packaging tutorial in Electron's | ||
* documentation](https://electronjs.org/docs/tutorial/application-packaging/). When the value | ||
* this feature include mitigating issues around long path names on Windows, slightly speeding | ||
* up `require`, and concealing your source code from cursory inspection. When the value | ||
* is `true`, it passes the default configuration to the `asar` module. The configuration | ||
@@ -339,3 +339,5 @@ * values can be customized when the value is an `Object`. Supported sub-options include, but | ||
* One or more files to be copied directly into the app's `Contents/Resources` directory for | ||
* macOS target platforms, and the `resources` directory for other target platforms. | ||
* macOS target platforms, and the `resources` directory for other target platforms. The | ||
* resources directory can be referenced in the packaged app via the | ||
* [`process.resourcesPath`](https://www.electronjs.org/docs/api/process#processresourcespath-readonly) value. | ||
*/ | ||
@@ -342,0 +344,0 @@ extraResource?: string | string[]; |
@@ -37,3 +37,3 @@ 'use strict' | ||
'For more information, please see\n' + | ||
`https://electron.github.io/electron-packager/master/interfaces/electronpackager.options.html#${hash}\n` | ||
`https://electron.github.io/electron-packager/main/interfaces/electronpackager.options.html#${hash}\n` | ||
} | ||
@@ -40,0 +40,0 @@ |
@@ -113,2 +113,3 @@ 'use strict' | ||
await this.copyTemplate() | ||
await common.validateElectronApp(this.opts.dir, this.originalResourcesAppDir) | ||
await this.asarApp() | ||
@@ -115,0 +116,0 @@ } |
@@ -5,2 +5,3 @@ 'use strict' | ||
const path = require('path') | ||
const { WrapperError } = require('cross-spawn-windows-exe') | ||
@@ -11,8 +12,6 @@ const App = require('./platform') | ||
function updateWineMissingException (err) { | ||
if (err && err.code === 'ENOENT' && ['spawn wine', 'spawn wine64'].includes(err.syscall)) { | ||
const binary = err.syscall.split(' ')[1] | ||
err.message = `Could not find "${binary}" on your system.\n\n` + | ||
if (err instanceof WrapperError) { | ||
err.message += '\n\n' + | ||
'Wine is required to use the appCopyright, appVersion, buildVersion, icon, and \n' + | ||
'win32metadata parameters for Windows targets.\n\n' + | ||
`Make sure that the "${binary}" executable is in your PATH.\n\n` + | ||
'See https://github.com/electron/electron-packager#building-windows-apps-from-non-windows-platforms for details.' | ||
@@ -90,13 +89,12 @@ } | ||
// Icon might be omitted or only exist in one OS's format, so skip it if normalizeExt reports an error | ||
const icon = await this.getIconPath() | ||
if (icon) { | ||
rcOpts.icon = icon | ||
} | ||
debug(`Running rcedit with the options ${JSON.stringify(rcOpts)}`) | ||
try { | ||
const icon = await this.getIconPath() | ||
if (icon) { | ||
rcOpts.icon = icon | ||
} | ||
debug(`Running rcedit with the options ${JSON.stringify(rcOpts)}`) | ||
await require('rcedit')(this.electronBinaryPath, rcOpts) | ||
} catch (err) { | ||
// Icon might be omitted or only exist in one OS's format, so skip it if normalizeExt reports an error | ||
/* istanbul ignore next */ | ||
throw updateWineMissingException(err) | ||
@@ -103,0 +101,0 @@ } |
@@ -57,3 +57,3 @@ Usage: electron-packager <sourcedir> <appname> [options...] | ||
ignore do not copy files into app whose filenames RegExp.match this string. See also: | ||
https://electron.github.io/electron-packager/master/interfaces/electronpackager.options.html#ignore | ||
https://electron.github.io/electron-packager/main/interfaces/electronpackager.options.html#ignore | ||
and --no-prune. Can be specified multiple times | ||
@@ -60,0 +60,0 @@ no-deref-symlinks make sure symlinks are not dereferenced within the app source |
130861
2060
207
18
7
+ Added@malept/cross-spawn-promise@1.1.1(transitive)
+ Addedcross-spawn@7.0.3(transitive)
+ Addedcross-spawn-windows-exe@1.2.0(transitive)
+ Addedis-docker@2.2.1(transitive)
+ Addedis-wsl@2.2.0(transitive)
+ Addedisexe@2.0.0(transitive)
+ Addedpath-key@3.1.1(transitive)
+ Addedrcedit@3.1.0(transitive)
+ Addedshebang-command@2.0.0(transitive)
+ Addedshebang-regex@3.0.0(transitive)
+ Addedspdx-license-ids@3.0.17(transitive)
+ Addedwhich@2.0.2(transitive)
- Removedrcedit@2.3.0(transitive)
- Removedspdx-license-ids@3.0.18(transitive)
Updatedrcedit@^3.0.1