mirror of
https://github.com/Llewellynvdm/nativefier.git
synced 2024-09-28 04:19:01 +00:00
Allow using png to build for OSX if OS is OSX
This commit is contained in:
parent
77b2d93fdd
commit
8eaa3a39e0
@ -18,7 +18,7 @@
|
||||
"clean": "gulp clean",
|
||||
"build": "gulp build",
|
||||
"watch": "while true ; do gulp watch ; done",
|
||||
"package-placeholder": "npm run build && node lib/cli.js http://www.bennish.net/web-notifications.html ~/Desktop --overwrite --app-name notification-test && open ~/Desktop/notification-test-darwin-x64/notification-test.app",
|
||||
"package-placeholder": "npm run build && node lib/cli.js http://www.bennish.net/web-notifications.html ~/Desktop --overwrite --app-name notification-test --icon ./test-resources/iconSampleGrey.png && open ~/Desktop/notification-test-darwin-x64/notification-test.app",
|
||||
"start-placeholder": "npm run build && electron app",
|
||||
"release": "gulp release"
|
||||
},
|
||||
|
@ -3,6 +3,8 @@ import path from 'path';
|
||||
import crypto from 'crypto';
|
||||
|
||||
import optionsFactory from './options';
|
||||
import pngToIcns from './getIcon';
|
||||
import helpers from './helpers';
|
||||
import packager from 'electron-packager';
|
||||
import tmp from 'tmp';
|
||||
import ncp from 'ncp';
|
||||
@ -12,6 +14,7 @@ import _ from 'lodash';
|
||||
import packageJson from './../package.json';
|
||||
|
||||
const copy = ncp.ncp;
|
||||
const isOSX = helpers.isOSX;
|
||||
|
||||
/**
|
||||
* @callback buildAppCallback
|
||||
@ -56,6 +59,17 @@ function buildApp(options, callback) {
|
||||
callback(error, tempDirPath, options);
|
||||
});
|
||||
},
|
||||
(tempDir, options, callback) => {
|
||||
if (options.platform !== 'darwin' || !isOSX()) {
|
||||
callback(null, tempDir, options);
|
||||
return;
|
||||
}
|
||||
|
||||
pngToIcns(options.icon, (error, icnsPath) => {
|
||||
options.icon = icnsPath;
|
||||
callback(error, tempDir, options);
|
||||
});
|
||||
},
|
||||
(tempDir, options, callback) => {
|
||||
options.dir = tempDir;
|
||||
packager(options, (error, appPathArray) => {
|
||||
@ -84,7 +98,6 @@ function buildApp(options, callback) {
|
||||
}
|
||||
|
||||
if (options.platform === 'darwin') {
|
||||
// todo mac icon copy
|
||||
callback(null, appPath);
|
||||
return;
|
||||
}
|
||||
|
9
src/helpers.js
Normal file
9
src/helpers.js
Normal file
@ -0,0 +1,9 @@
|
||||
import os from 'os';
|
||||
|
||||
function isOSX() {
|
||||
return os.platform() === 'darwin';
|
||||
}
|
||||
|
||||
export default {
|
||||
isOSX: isOSX
|
||||
};
|
Loading…
Reference in New Issue
Block a user