mirror of
https://github.com/Llewellynvdm/nativefier.git
synced 2024-12-22 10:08:55 +00:00
Rename 'pngToIcns to convertToIcns'
This commit is contained in:
parent
ca44ee28aa
commit
34a5a52a28
@ -2,9 +2,9 @@
|
||||
|
||||
### USAGE
|
||||
|
||||
# ./pngToIcns <input png> <outp icns>
|
||||
# ./convertToIcns <input png> <outp icns>
|
||||
# Example
|
||||
# ./pngToIcns.sh ~/sample.png ~/Desktop/converted.icns
|
||||
# ./convertToIcns ~/sample.png ~/Desktop/converted.icns
|
||||
|
||||
# exit the shell script on error immediately
|
||||
set -e
|
@ -1,6 +1,6 @@
|
||||
import path from 'path';
|
||||
import helpers from './../helpers/helpers';
|
||||
import pngToIcns from './../helpers/pngToIcns';
|
||||
import convertToIcns from './../helpers/convertToIcns';
|
||||
import singleIco from './../helpers/singleIco';
|
||||
const isOSX = helpers.isOSX;
|
||||
|
||||
@ -68,7 +68,7 @@ function iconBuild(options, callback) {
|
||||
return;
|
||||
}
|
||||
|
||||
pngToIcns(options.icon, (error, icnsPath) => {
|
||||
convertToIcns(options.icon, (error, icnsPath) => {
|
||||
options.icon = icnsPath;
|
||||
if (error) {
|
||||
console.warn('Skipping icon conversion from `.png` to `.icns`: ', error);
|
||||
|
@ -5,7 +5,7 @@ import helpers from './helpers';
|
||||
const isOSX = helpers.isOSX;
|
||||
tmp.setGracefulCleanup();
|
||||
|
||||
const PNG_TO_ICNS_BIN_PATH = path.join(__dirname, '../..', 'bin/pngToIcns');
|
||||
const PNG_TO_ICNS_BIN_PATH = path.join(__dirname, '../..', 'bin/convertToIcns');
|
||||
|
||||
/**
|
||||
* @callback pngToIcnsCallback
|
||||
@ -19,7 +19,7 @@ const PNG_TO_ICNS_BIN_PATH = path.join(__dirname, '../..', 'bin/pngToIcns');
|
||||
* @param {string} icnsDest
|
||||
* @param {pngToIcnsCallback} callback
|
||||
*/
|
||||
function pngToIcns(pngSrc, icnsDest, callback) {
|
||||
function convertToIcns(pngSrc, icnsDest, callback) {
|
||||
if (!isOSX()) {
|
||||
callback('OSX is required to convert .png to .icns icon', pngSrc);
|
||||
return;
|
||||
@ -48,10 +48,10 @@ function pngToIcns(pngSrc, icnsDest, callback) {
|
||||
* @param {string} pngSrc
|
||||
* @param {pngToIcnsCallback} callback
|
||||
*/
|
||||
function pngToIcnsTmp(pngSrc, callback) {
|
||||
function convertToIcnsTmp(pngSrc, callback) {
|
||||
const tempIconDirObj = tmp.dirSync({unsafeCleanup: true});
|
||||
const tempIconDirPath = tempIconDirObj.name;
|
||||
pngToIcns(pngSrc, `${tempIconDirPath}/icon.icns`, callback);
|
||||
convertToIcns(pngSrc, `${tempIconDirPath}/icon.icns`, callback);
|
||||
}
|
||||
|
||||
export default pngToIcnsTmp;
|
||||
export default convertToIcnsTmp;
|
@ -5,14 +5,14 @@ import chai from 'chai';
|
||||
import fs from 'fs';
|
||||
import os from 'os';
|
||||
import path from 'path';
|
||||
import pngToIcns from './../../lib/helpers/pngToIcns';
|
||||
import convertToIcns from './../../lib/helpers/convertToIcns';
|
||||
|
||||
let assert = chai.assert;
|
||||
|
||||
// Prerequisite for test: to use OSX with sips, iconutil and imagemagick convert
|
||||
|
||||
function testConvertPng(pngName, done) {
|
||||
pngToIcns(path.join(__dirname, '../../', 'test-resources', pngName), (error, icnsPath) => {
|
||||
convertToIcns(path.join(__dirname, '../../', 'test-resources', pngName), (error, icnsPath) => {
|
||||
if (error) {
|
||||
done(error);
|
||||
return;
|
||||
|
Loading…
Reference in New Issue
Block a user