Skip to content

Commit

Permalink
Fixed 'output' command line option handling
Browse files Browse the repository at this point in the history
Tweaked doc and code
  • Loading branch information
olivab committed Nov 22, 2017
1 parent 7849957 commit ca11f1b
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 21 deletions.
3 changes: 3 additions & 0 deletions .jshintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"esversion": 6
}
36 changes: 20 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# cordova-res-generator

## Introduction

Automatic icon and splash screen resizing CLI tool for **Cordova**/**Ionic**/**PhoneGap** based applications.

It automatically resizes and copies your ```icon.png``` and ```splash.png``` files to platform dedicated directories.
Expand All @@ -8,17 +10,19 @@ It does **NOT require** any external binary libraries. **Javascript only**.

---

### Installation
## Installation

$ npm install cordova-res-generator -g

---

### Usage
## Usage

### Required files

Add your ```icon.png``` (1024x1024) and ```splash.png``` (2732x2732) files to the 'resources' folder under the root of your cordova based project.
Add your ```icon.png``` (1024x1024 px) and ```splash.png``` (2732x2732 px) files to the 'resources' folder under the root of your cordova based project.

Then run:
### Command line

$ cordova-res-generator

Expand All @@ -28,7 +32,7 @@ or

**ATTENTION:** while preserving source files, it overwrites previous output if any.

Options:
### Options

-V, --version output the version number
-i, --icon [optional] optional icon file path
Expand All @@ -38,32 +42,32 @@ Options:
-p, --platforms [optional] optional platform token comma separated list
available tokens: android, ios, windows, blackberry10
(default: all platforms processed)
-o, -outputdir [optional] optional output directory
-o, --outputdir [optional] optional output directory
(default: ./resources/)
-I, --makeicon [optional] option to process icon files only
-S, --makesplash [optional] option to process splash files only
-h, --help output usage information

---

### Platforms
## Platforms

Supported platforms:

- **iOS**
- icons
- splash
- icons
- splash screens
- **Android**
- icons
- splash
- icons
- splash screens
- **Windows**
- icons
- splash
- icons
- splash screens
- **Blackberry 10**
- icons
- icons

---
---

### License
## License

MIT
8 changes: 4 additions & 4 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ function getImages(settings) {
});
}
if (settings.makesplash) {
promise = promise.then(() => checkSplashFile(settings.splashFileName))
promise = promise.then(() => checkSplashFile(settings.splashfile))
.then((image) => {
imageObjects.splash = image;
});
Expand All @@ -125,7 +125,7 @@ function getImages(settings) {
function checkIconFile(iconFileName) {
var defer = Q.defer();

Jimp.read(settings.iconfile)
Jimp.read(iconFileName)
.then((image) => {
var width = image.bitmap.width;
var height = image.bitmap.height;
Expand All @@ -148,7 +148,7 @@ function getImages(settings) {
function checkSplashFile(splashFileName) {
var defer = Q.defer();

Jimp.read(settings.splashfile)
Jimp.read(splashFileName)
.then((image) => {
var width = image.bitmap.width;
var height = image.bitmap.height;
Expand Down Expand Up @@ -284,7 +284,7 @@ program
.option('-i, --icon [optional]', 'optional icon file path (default: ./resources/icon.png)')
.option('-s, --splash [optional]', 'optional splash file path (default: ./resources/splash.png)')
.option('-p, --platforms [optional]', 'optional platform token comma separated list (default: all platforms processed)')
.option('-o, -outputdir [optional]', 'optional output directory (default: ./resources/)')
.option('-o, --outputdir [optional]', 'optional output directory (default: ./resources/)')
.option('-I, --makeicon [optional]', 'option to process icon files only')
.option('-S, --makesplash [optional]', 'option to process splash files only')
.parse(process.argv);
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "cordova-res-generator",
"version": "0.3.0",
"version": "0.3.1",
"description": "Generates icon & splash screen for cordova/ionic projects using javascript only.",
"main": "index.js",
"preferGlobal": false,
Expand Down

0 comments on commit ca11f1b

Please sign in to comment.