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

docs: Fix API in readme #53

Merged
merged 2 commits into from
Jul 27, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 12 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,19 @@ Options:
--overwrite Overwrite any existing DMG.
-h --help Show this screen.
--version Show version.

```

### API

```javascript
var createDMG = require('electron-installer-dmg')
createDMG(opts, function done (err) { })
const createDMG = require('electron-installer-dmg');

async function buildDMG() {
await createDMG({
appPath: '/path/to/app.app',
name: 'MyApp'
});
}
```
#### createDMG(opts, callback)

Expand Down Expand Up @@ -77,13 +82,13 @@ How big to make the icon for the app in the DMG. [Default: `80`].
`contents` - *Array* or *Function* that returns an Array of objects.
The content that will appear in the window when user opens the `.dmg` file.
[Default: Array of two icons, application and application destination folder].
Array Example:
```
Array example:
```javascript
[ { x: 448, y: 344, type: 'link', path: '/Applications'},
{ x: 192, y: 344, type: 'file', path: '/path/to/application.app'} ]
```
Function Example (more flexible for getting useful options used in creating dmg):
```
Function example (more flexible for getting useful options used in creating a DMG):
```javascript
function (opts) {
return [ { x: 448, y: 344, type: 'link', path: '/Applications'},
{ x: 192, y: 344, type: 'file', path: opts.appPath} ];
Expand All @@ -108,12 +113,6 @@ Additional options to pass through to [`appdmg`](https://npm.im/appdmg)
You can use this to set additional features like `background-color` and
`code-sign`. See the docs of the `appdmg` module for all possible options.


##### callback

`err` - *Error*
Contains errors if any.

## License

Apache 2.0
Expand Down