安装appdmg

  1. npm install -g appdmg

使用

  1. # json-path: Path to the JSON Specification file
  2. # dmg-path: Path at which to place the final DMG
  3. appdmg <json-path> <dmg-path>
  4. # 示例
  5. appdmg test/assets/appdmg.json ~/Desktop/test.dmg

JSON 输入文件格式

  1. {
  2. "title": "Test Application",
  3. "icon": "test-app.icns",
  4. "background": "test-background.png",
  5. "contents": [
  6. { "x": 448, "y": 344, "type": "link", "path": "/Applications" },
  7. { "x": 192, "y": 344, "type": "file", "path": "TestApp.app" }
  8. ]
  9. }

mac 使用脚本打包 dmg - 图1

https://github.com/LinusU/node-appdmg