Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/electron-userland/electron-installer-dmg
Create DMG installers for your electron apps using appdmg.
https://github.com/electron-userland/electron-installer-dmg
Last synced: about 1 month ago
JSON representation
Create DMG installers for your electron apps using appdmg.
- Host: GitHub
- URL: https://github.com/electron-userland/electron-installer-dmg
- Owner: electron-userland
- License: apache-2.0
- Created: 2015-07-06T13:36:21.000Z (about 9 years ago)
- Default Branch: main
- Last Pushed: 2023-02-27T13:57:12.000Z (over 1 year ago)
- Last Synced: 2024-05-17T00:45:40.192Z (4 months ago)
- Language: JavaScript
- Homepage: https://github.com/electron-userland/electron-installer-dmg
- Size: 1.7 MB
- Stars: 306
- Watchers: 12
- Forks: 39
- Open Issues: 15
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# electron-installer-dmg
[![CI status][actions_img]][actions_url]
[![npm][npm_img]][npm_url]
[![Code coverage](https://codecov.io/gh/electron-userland/electron-installer-dmg/branch/main/graph/badge.svg?token=xtM3VTig9I)](https://codecov.io/gh/electron-userland/electron-installer-dmg)> Create DMG installers for your electron apps using [appdmg][appdmg].
## Requirements
This module requires using macOS and Node 16 or above.
## Installation
**For use in npm scripts:**
```bash
npm i electron-installer-dmg --save-dev
```**For use from cli:**
```bash
npm i electron-installer-dmg -g
```## Usage
```
Usage: electron-installer-dmgCreate DMG installers for your electron apps.
Usage:
electron-installer-dmg ./FooBar-darwin-x64/FooBar.app FooBarOptions:
--out= The directory to put the DMG into. [Default: `process.cwd()`].
--icon= Path to the icon file that will be the app icon in the DMG window.
--icon-size= How big to make the icon for the app in the DMG. [Default: `80`].
--background= Path to a PNG image to use as the background of the DMG. [Size: 658 x 498]
--title= The title of the produced DMG, which will be shown when mounted.
--overwrite Overwrite any existing DMG.
-h --help Show this screen.
--version Show version.
```### API
```javascript
const { createDMG } = require('electron-installer-dmg');async function buildDMG() {
await createDMG({
appPath: '/path/to/app.app',
name: 'MyApp'
});
}
```
#### createDMG(opts)##### `opts`
`appPath` - *String* - **Required**
The `.app` directory generated by [electron-packager][electron-packager].`name` - *String* - **Required**
The application name.`title` - *String*
The title of the produced DMG, which will be shown when mounted.`background` - *String*
Path to the background for the DMG window. Background image should be of size 658 × 498.`icon` - *String*
Path to the icon to use for the app in the DMG window.`iconSize` - *Number*
How big to make the icon for the app in the DMG. [Default: `80`].`overwrite` - *Boolean*
Overwrite an existing DMG file if if already exists.`out` - *String*
The directory to put the DMG into. [Default: `process.cwd()`].`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:
```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 a DMG):
```javascript
function (opts) {
return [ { x: 448, y: 344, type: 'link', path: '/Applications'},
{ x: 192, y: 344, type: 'file', path: opts.appPath} ];
}
````format` - *String*
Disk image format. [Default: `UDZO`].[Must be one of the following][spec]:
- `UDRW` :arrow_right: read/write image
- `UDRO` :arrow_right: read-only image
- `UDCO` :arrow_right: ADC-compressed image
- `UDZO` :arrow_right: zlib-compressed image
- `UDBZ` :arrow_right: bzip2-compressed image
- `ULFO` :arrow_right: lzfse-compressed image (macOS 10.11+ only)`additionalDMGOptions` - *Object*
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.## License
Apache 2.0
[actions_img]: https://github.com/electron-userland/electron-installer-dmg/actions/workflows/ci.yml/badge.svg
[actions_url]: https://github.com/electron-userland/electron-installer-dmg/actions/workflows/ci.yml
[npm_img]: https://img.shields.io/npm/v/electron-installer-dmg.svg
[npm_url]: https://npm.im/electron-installer-dmg
[electron-packager]: https://github.com/electron/electron-packager
[appdmg]: https://github.com/LinusU/node-appdmg
[spec]: https://github.com/LinusU/node-appdmg#specification