cordova-icon-cli
Advanced tools
Comparing version 0.3.1 to 0.3.2
54
index.js
@@ -1,10 +0,33 @@ | ||
var fs = require('fs'); | ||
var xml2js = require('xml2js'); | ||
var ig = require('imagemagick'); | ||
var colors = require('colors'); | ||
var _ = require('underscore'); | ||
var Q = require('q'); | ||
var argv = require('yargs').argv; | ||
var fs = require('fs'), | ||
xml2js = require('xml2js'), | ||
ig = require('imagemagick'); | ||
colors = require('colors'), | ||
_ = require('underscore'); | ||
Q = require('q'), | ||
argv = require('yargs').argv, | ||
mkdir = require('mkdir-p'); | ||
String.prototype.stripTrailingSlash = function(str) { | ||
if(this.substr(-1) === '/') { | ||
return this.substr(0, this.length - 1); | ||
} | ||
return this; | ||
} | ||
if (!String.prototype.includes) { | ||
String.prototype.includes = function() {'use strict'; | ||
return String.prototype.indexOf.apply(this, arguments) !== -1; | ||
}; | ||
} | ||
/** | ||
* @var {Object} settings - names of the confix file and of the icon image | ||
*/ | ||
var settings = {}; | ||
settings.CONFIG_FILE = argv.config || 'config.xml'; | ||
settings.ICON_FILE = argv.icon || 'icon.png'; | ||
settings.IOS_DEST = argv['ios-dest'] ? argv['ios-dest'].stripTrailingSlash() : false; | ||
settings.ANDROID_DEST = argv['android-dest'] ? argv['android-dest'].stripTrailingSlash() : false; | ||
/** | ||
* Check which platforms are added to the project and return their icon names and sized | ||
@@ -22,3 +45,3 @@ * | ||
isAdded : fs.existsSync('platforms/ios'), | ||
iconsPath : 'platforms/ios/' + projectName + '/Resources/icons/', | ||
iconsPath : settings.IOS_DEST ? settings.IOS_DEST + '/ios/' : 'platforms/ios/' + projectName + '/Resources/icons/', | ||
icons : [ | ||
@@ -44,3 +67,3 @@ { name : 'icon-40.png', size : 40 }, | ||
name : 'android', | ||
iconsPath : 'platforms/android/res/', | ||
iconsPath :settings.ANDROID_DEST ? settings.ANDROID_DEST + '/android/' : 'platforms/android/res/', | ||
isAdded : fs.existsSync('platforms/android'), | ||
@@ -62,11 +85,3 @@ icons : [ | ||
/** | ||
* @var {Object} settings - names of the confix file and of the icon image | ||
*/ | ||
var settings = {}; | ||
settings.CONFIG_FILE = argv.config || 'config.xml'; | ||
settings.ICON_FILE = argv.icon || 'icon.png'; | ||
/** | ||
* @var {Object} console utils | ||
@@ -121,2 +136,7 @@ */ | ||
var deferred = Q.defer(); | ||
if( !platform.iconsPath.includes('ios') ){ | ||
mkdir.sync(platform.iconsPath + icon.name.split('/icon.png')[0]); | ||
}else { | ||
mkdir.sync(platform.iconsPath); | ||
} | ||
ig.resize({ | ||
@@ -123,0 +143,0 @@ srcPath: settings.ICON_FILE, |
{ | ||
"name": "cordova-icon-cli", | ||
"version": "0.3.1", | ||
"version": "0.3.2", | ||
"description": "Automatic icon resizing for Cordova", | ||
@@ -31,2 +31,3 @@ "main": "index.js", | ||
"imagemagick": "^0.1.3", | ||
"mkdir-p": "0.0.7", | ||
"q": "^1.0.1", | ||
@@ -33,0 +34,0 @@ "underscore": "^1.6.0", |
@@ -9,3 +9,3 @@ # cordova-icon | ||
$ sudo npm install cordova-icon -g | ||
$ sudo npm install cordova-icon-cli -g | ||
@@ -18,2 +18,6 @@ ### Usage | ||
To specify a custom splash image or config file use it like this: | ||
$ cordova-icon --icon path/to/icon --config /path/to/config | ||
For optimal results, your file has to be square, and at least 180\*180px. | ||
@@ -20,0 +24,0 @@ To be future-proof, since the generated file dimensions are going to evolve, you should probably use 512\*512px or 1024\*1024px. |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
21703
258
63
7
+ Addedmkdir-p@0.0.7
+ Addedmkdir-p@0.0.7(transitive)