Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Drop callback support #916

Merged
merged 1 commit into from Dec 4, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
20 changes: 8 additions & 12 deletions docs/api.md
@@ -1,20 +1,22 @@
# electron-packager API

Short Promise example:
Short `async`/`await` example:

```javascript
const packager = require('electron-packager')
packager(options)
.then(appPaths => { /* … */ })
const appPaths = await packager(options)
```

Short [(deprecated) callback syntax](#callback) example:
Short Promise example:

```javascript
const packager = require('electron-packager')
packager(options, function done_callback (err, appPaths) { /* … */ })
packager(options)
.then(appPaths => { /* … */ })
```

`appPaths` is described in the [return value](#return-value) section.

## `options`

### Required
Expand Down Expand Up @@ -461,13 +463,7 @@ Object (also known as a "hash") of application metadata to embed into the execut

For more information, see the [`node-rcedit` module](https://github.com/electron/node-rcedit).

## callback

### `err`

*Error* (or *Array*, in the case of an `copy` error)

Contains errors, if any.
## Return value

### `appPaths`

Expand Down
11 changes: 1 addition & 10 deletions index.js
Expand Up @@ -8,7 +8,6 @@ const fs = require('fs-extra')
const getMetadataFromPackageJSON = require('./infer')
const hooks = require('./hooks')
const ignore = require('./ignore')
const nodeify = require('nodeify')
const path = require('path')
const pify = require('pify')
const targets = require('./targets')
Expand Down Expand Up @@ -145,7 +144,7 @@ function packageAllSpecifiedCombos (opts, archs, platforms) {
)))
}

function packagerPromise (opts) {
module.exports = function packager (opts) {
debugHostInfo()
if (debug.enabled) debug(`Packager Options: ${JSON.stringify(opts)}`)

Expand Down Expand Up @@ -175,11 +174,3 @@ function packagerPromise (opts) {
// Remove falsy entries (e.g. skipped platforms)
.then(appPaths => appPaths.filter(appPath => appPath))
}

module.exports = function packager (opts, cb) {
if (cb) {
/* istanbul ignore next */
common.warning('The callback-based version of packager() is deprecated and will be removed in a future major version, please convert to the Promise version or use the nodeify module.')
}
return nodeify(packagerPromise(opts), cb)
}
1 change: 0 additions & 1 deletion package.json
Expand Up @@ -26,7 +26,6 @@
"fs-extra": "^7.0.0",
"galactus": "^0.2.1",
"get-package-info": "^1.0.0",
"nodeify": "^1.0.1",
"parse-author": "^2.0.0",
"pify": "^4.0.0",
"plist": "^3.0.0",
Expand Down
4 changes: 2 additions & 2 deletions readme.md
Expand Up @@ -61,10 +61,10 @@ It generates executables/bundles for the following **target** platforms:
This module requires Node.js 6.0 or higher to run.

```sh
# for use in npm scripts
# For use in npm scripts (recommended)
npm install electron-packager --save-dev

# for use from cli
# For use from the CLI
npm install electron-packager -g
```

Expand Down