From 17bb31f16d5322d66e9061088dcf9f3af51a8d32 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Linus=20Unneb=C3=A4ck?= Date: Sun, 22 May 2016 18:13:00 +0200 Subject: [PATCH] Make icon-size optional Fixes #105 --- README.md | 3 +-- lib/appdmg.js | 2 +- schema.json | 1 - test/api.js | 2 -- test/assets/appdmg-bg-color.json | 1 - test/assets/appdmg.json | 1 - 6 files changed, 2 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 0fec39a..dd07eb9 100644 --- a/README.md +++ b/README.md @@ -39,7 +39,6 @@ the JSON file's path. "title": "Test Application", "icon": "test-app.icns", "background": "test-background.png", - "icon-size": 80, "contents": [ { "x": 448, "y": 344, "type": "link", "path": "/Applications" }, { "x": 192, "y": 344, "type": "file", "path": "TestApp.app" } @@ -53,7 +52,7 @@ the JSON file's path. + `icon` (string, optional) - Path to your icon, which will be shown when mounted + `background` (string, optional) - Path to your background + `background-color` (string, optional) - Background color (accepts css colors) -+ `icon-size` (string, required) - Size of all the icons inside the DMG ++ `icon-size` (string, optional) - Size of all the icons inside the DMG + `window` (object, optional) - Window options + `position` (object, optional) - Position when opened + `x` (number, required) - X position relative to bottom of the screen diff --git a/lib/appdmg.js b/lib/appdmg.js index 557ec93..a92b6fa 100644 --- a/lib/appdmg.js +++ b/lib/appdmg.js @@ -354,7 +354,7 @@ module.exports = exports = function (options) { var ds = new DSStore() ds.vSrn(1) - ds.setIconSize(global.opts['icon-size']) + ds.setIconSize(global.opts['icon-size'] || 80) if (global.opts['background-color']) { var rgb = parseColor(global.opts['background-color']).rgb diff --git a/schema.json b/schema.json index d855b92..f0e9e6c 100644 --- a/schema.json +++ b/schema.json @@ -99,7 +99,6 @@ }, "required": [ "title", - "icon-size", "contents" ] } diff --git a/test/api.js b/test/api.js index 9351a3a..f0b2987 100644 --- a/test/api.js +++ b/test/api.js @@ -89,7 +89,6 @@ describe('api', function () { title: 'Test Title', icon: 'TestIcon.icns', background: 'TestBkg.png', - 'icon-size': 80, contents: [ { x: 448, y: 344, type: 'link', path: '/Applications' }, { x: 192, y: 344, type: 'file', path: 'TestApp.app' }, @@ -118,7 +117,6 @@ describe('api', function () { icon: 'TestIcon.icns', background: 'TestBkg.png', format: 'UDRO', - 'icon-size': 80, contents: [ { x: 448, y: 344, type: 'link', path: '/Applications' }, { x: 192, y: 344, type: 'file', path: 'TestApp.app' }, diff --git a/test/assets/appdmg-bg-color.json b/test/assets/appdmg-bg-color.json index 5f6dd52..80ae7d6 100644 --- a/test/assets/appdmg-bg-color.json +++ b/test/assets/appdmg-bg-color.json @@ -2,7 +2,6 @@ "title": "Test Title", "icon": "TestIcon.icns", "background-color": "mintcream", - "icon-size": 80, "contents": [ { "x": 448, "y": 344, "type": "link", "path": "/Applications" }, { "x": 192, "y": 344, "type": "file", "path": "TestApp.app" }, diff --git a/test/assets/appdmg.json b/test/assets/appdmg.json index 5601117..3431946 100644 --- a/test/assets/appdmg.json +++ b/test/assets/appdmg.json @@ -2,7 +2,6 @@ "title": "Test Title", "icon": "TestIcon.icns", "background": "TestBkg.png", - "icon-size": 80, "contents": [ { "x": 448, "y": 344, "type": "link", "path": "/Applications" }, { "x": 192, "y": 344, "type": "file", "path": "TestApp.app" },