mirror of
https://github.com/Llewellynvdm/nativefier.git
synced 2024-11-11 07:41:04 +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",
|
"clean": "gulp clean",
|
||||||
"build": "gulp build",
|
"build": "gulp build",
|
||||||
"watch": "while true ; do gulp watch ; done",
|
"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",
|
"start-placeholder": "npm run build && electron app",
|
||||||
"release": "gulp release"
|
"release": "gulp release"
|
||||||
},
|
},
|
||||||
|
@ -3,6 +3,8 @@ import path from 'path';
|
|||||||
import crypto from 'crypto';
|
import crypto from 'crypto';
|
||||||
|
|
||||||
import optionsFactory from './options';
|
import optionsFactory from './options';
|
||||||
|
import pngToIcns from './getIcon';
|
||||||
|
import helpers from './helpers';
|
||||||
import packager from 'electron-packager';
|
import packager from 'electron-packager';
|
||||||
import tmp from 'tmp';
|
import tmp from 'tmp';
|
||||||
import ncp from 'ncp';
|
import ncp from 'ncp';
|
||||||
@ -12,6 +14,7 @@ import _ from 'lodash';
|
|||||||
import packageJson from './../package.json';
|
import packageJson from './../package.json';
|
||||||
|
|
||||||
const copy = ncp.ncp;
|
const copy = ncp.ncp;
|
||||||
|
const isOSX = helpers.isOSX;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @callback buildAppCallback
|
* @callback buildAppCallback
|
||||||
@ -56,6 +59,17 @@ function buildApp(options, callback) {
|
|||||||
callback(error, tempDirPath, options);
|
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) => {
|
(tempDir, options, callback) => {
|
||||||
options.dir = tempDir;
|
options.dir = tempDir;
|
||||||
packager(options, (error, appPathArray) => {
|
packager(options, (error, appPathArray) => {
|
||||||
@ -84,7 +98,6 @@ function buildApp(options, callback) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (options.platform === 'darwin') {
|
if (options.platform === 'darwin') {
|
||||||
// todo mac icon copy
|
|
||||||
callback(null, appPath);
|
callback(null, appPath);
|
||||||
return;
|
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