How to add an End User License Agreement using Electron Builder for Mac

Viewed 10

I have a program that is being built using electron-builder. On the Windows version, during the installation, it displays a window for the user to Accept/Decline the End User License Agreement.

However, for the Mac version, when I run the DMG, it prompts for the user to drag the app to the Applications folder, and then runs like normal.

I would like a EULA prompt to appear before the user can run the program, ideally before they could even install it.

here is the electron-builder.json

{
  "productName": "Software",
  "directories": {
    "output": "release/"
  },
  "files": [
    "**/*",
    "!**/*.ts",
    "!*.code-workspace",
    "!LICENSE.md",
    "!package.json",
    "!package-lock.json",
    "!src/",
    "!e2e/",
    "!hooks/",
    "!test/",
    "!angular.json",
    "!_config.yml",
    "!karma.conf.js",
    "!tsconfig.json",
    "!tslint.json",
    "!deps"
  ],
  "extraResources": [
    "deps/**/*"
  ],
  "win": {
    "icon": "src/assets/icons/nxicon2brand.png",
    "target": [{
        "target": "nsis",
        "arch": [
          "x64"
        ]
    }]
  },
  "mac": {
    "icon": "src/assets/icons/nxicon2brand.png",
    "target": [
      "dmg"
    ]
  },
  "linux": {
    "icon": "src/assets/icons/nxicon2brand.png",
    "target": [
      "AppImage"
    ]
  },
  "nsis": {
    "oneClick": false,
    "perMachine": true,
    "allowElevation": true,
    "allowToChangeInstallationDirectory": true,
    "license": "EULA2021.txt"
  },
  dmg: {
    background: "installer/mac/gaston.png",
    iconSize: 100,
    contents: [
      {
        x: 255,
        y: 85,
        type: "file"
      },
      {
        x: 253,
        y: 325,
        type: "link",
        path: "/Applications"
      }
    ],
    window: {
      width: 500,
      height: 500
    }
  }


}

I can see the Gaston image in the background so I figure I'm in the right area, but no sign of a license agreement anywhere.

I've also created a license_EN.txt file containing the definition of how the window should look

{
  "lang": "English",
  "agree": "Agree",
  "disagree": "Disagree",
  "print": "Print",
  "save": "Save",
  "description": "Here is my own description"
}

The release folder is populated with the new dmg, when I double click it mounts the file in Locations, and then it prompts me to drag the icon to applications. After that, if I click on the software icon, it begins running like normal.

0 Answers
Related