Skip to content

Commit

Permalink
Drop callback support (#916)
Browse files Browse the repository at this point in the history
Removes callback-style support (use `nodeify` if you need that still), and adds an `async`/`await` example to the API docs.
  • Loading branch information
malept committed Dec 4, 2018
1 parent 3cbb080 commit a533d5f
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 25 deletions.
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

0 comments on commit a533d5f

Please sign in to comment.