LinusU / LinusU/node-appdmg

Exposing disk image size option to user

Open
#197 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
1.7k
Forks
158
PR merge metrics
No merged PRs in 30d

Description

I'm forwarding a problem I had when I build DMG with `electron-forge`, [which is said to be an appdmg limitation](https://github.com/electron-userland/electron-forge/issues/2133#issuecomment-763077551).

TL;DR: Can node-appdmg expose an option similar to `--disk-img-size` of [create-dmg](https://github.com/create-dmg/create-dmg) ??

Please see below.

### Issue Details

* **Electron Forge Version:**
* 6.0.0-beta.53
* **Electron Version:**
*
* **Operating System:**
* macOS 10.15.7
* **Last Known Working Electron Forge version:**:
* N/A

### Expected Behavior

I'd love to insert custom data into the app folder and have them included into the DMG and show up in the mounted folder.

### Actual Behavior

Trying to insert additional data into the output app folder and include it into the DMG, but after firing up a maker process, I saw a size calculation error that breaks the build

```sh
Making for the following targets: dmg
✖ Making for target: dmg - On platform: darwin - For arch: x64

An unhandled error has occurred inside Forge:
An error occured while making for target: dmg
Command failed: hdiutil create /var/folders/5j/ybqw096s7c162l_lgby0plw00000gn/T/N8YZNXR.dmg -ov -fs HFS+ -size 7313m -volname MAM-Hub
hdiutil: create failed - No space left on device
```
the size argument is incorrect and after digging into the source code of electron-forge, I found that this size is calculated internally and the `hdiutil` `-size` argument is not exposed.

### To Reproduce

- Create an Electron app and build it with `electron-forge`;
- Add a folder of data, in my case, another dependency PKG installer and its own supporting data, into the output folder;
- Build the app with yarn or npm;

You should see the similar error above.

### Additional Information

Here is my `package.json`

```json
{
"name": "myapp",
"productName": "myapp",
"version": "0.10.1",
"description": "my app",
"main": "src/main.js",
"scripts": {
"start": "electron-forge start",
"package": "electron-forge package",
"make": "electron-forge make",
"publish": "electron-forge publish",
"lint": "echo \"No linting configured\""
},
"keywords": [],
"author": {
"name": "me",
"email": "me@me.com"
},
"license": "MIT",
"config": {
"forge": {
"packagerConfig": {
"icon": "src/images/myicon",
"ignore": [
"/.gitignore",
"/.vscode",
"/yarn.lock",
"/node_modules/xyz/10.1.2/",
"/node_modules/xyz/build/",
"/node_modules/xyz/prebuilds/linux*"
]
},
"osxSign": {
"entitlements": "entitlements.plist",
"entitlements-inherit": "entitlements.plist",
"gatekeeper-assess": false,
"hardened-runtime": true,
"identity": "my id",
"signature-flags": "library"
},
"osxNotarize": "require:./notarize.js",
"hooks": "require:./hooks.js",
"makers": [
{
"name": "@electron-forge/maker-dmg",
"platforms": [
"darwin"
],
"config": {
"AdditionalDMGOptions": {
"code-sign": {
"identifier": "my certificate",
"signing-identity": "my cert id"
},
"contents": [
{
"name": "MAM-hub",
"path": "src/myapp/out/myapp-darwin-x64/myapp.app",
"type": "file",
"x": 370,
"y": 260
},
{
"name": "Applications",
"path": "/Applications",
"type": "link",
"x": 670,
"y": 260
},
{
"name": "My Dependency",
"path": "src/mam-hub/out/mam-hub-darwin-x64/mydep",
"type": "file",
"x": 240,
"y": 260
},
{
"name": "INSTALL.html",
"path": "../../temp/INSTALL_en.html",
"x": 240,
"y": 400
},
{
"name": "安装指南.html",
"path": "../../temp/INSTALL_zhs.html",
"x": 370,
"y": 400
}
],
"window": {
"position": {
"x": 200,
"y": 120
},
"size": {
"height": 660,
"width": 1020
}
}
},
"background": "../../res/installer/macos/background-orange.png",
"format": "UDZO",
"icon": "src/images/myapp.icns",
"iconSize": 90,
"name": "myapp",
"overwrite": true
}
},
{
"name": "@electron-forge/maker-wix",
"platforms": [
"win32"
],
"config": {
"arch": "x64",
"appUserModelId": "com.me.myapp",
"description": "description of myapp",
"exe": "myapp",
"iconPath": "src\\images\\me.ico",
"language": 1033,
"manufacturer": "me",
"name": "my app",
"programFilesFolderName": "myapp",
"shortName": "myapp",
"shortcutFolderName": "myapp",
"ui": {
"chooseDirectory": true,
"images": {
"background": "C:\\Temp\\background-orange.png",
"banner": "C:\\Temp\\banner-orange.png"
}
},
"version": "1.0.0"
}
}
]
}
},
"dependencies": {
"buffer-from": "^1.1.1",
"zeromq": "^6.0.0-beta.6"
},
"devDependencies": {
"@electron-forge/cli": "6.0.0-beta.53",
"@electron-forge/maker-dmg": "6.0.0-beta.53",
"@electron-forge/maker-wix": "6.0.0-beta.53",
"electron": "10.1.2"
}
}
```

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

The issue shows the failing hdiutil create invocation and the maker-dmg AdditionalDMGOptions configuration; start by tracing how node-appdmg assembles that command. Compare the requested --disk-img-size behavior with the current -size handling, then verify that a configured image size is passed through and prevents the reported no-space failure.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
build-system
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.