Skip to content

Commit

Permalink
Add support for pwa - fixes #7
Browse files Browse the repository at this point in the history
  • Loading branch information
SamVerschueren committed Jan 15, 2019
1 parent 41d9549 commit 4b6bcf1
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 3 deletions.
2 changes: 2 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,15 @@ const pathExists = require('path-exists');
const pify = require('pify');
const gm = require('gm');
const mkdir = require('mkdirp');
const pwaIcons = require('pwa-icon-list');
const androidIcons = require('android-icon-list');
const bb10Icons = require('bb10-icon-list');
const iosIcons = require('ios-icon-list');

const mkdirp = pify(mkdir);

const platformIcons = {
pwa: pwaIcons(),
android: androidIcons(),
ios: iosIcons(),
blackberry10: bb10Icons()
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@
"ios-icon-list": "^1.0.0",
"mkdirp": "^0.5.1",
"path-exists": "^3.0.0",
"pify": "^2.3.0"
"pify": "^2.3.0",
"pwa-icon-list": "^1.0.0"
},
"devDependencies": {
"ava": "*",
Expand Down
15 changes: 13 additions & 2 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ Source file of the icon.

*Required*<br>
Type: `string`<br>
Values: `android` `ios` `blackberry10`
Values: `pwa` `android` `ios` `blackberry10`

Platform to generate the icons for.

Expand Down Expand Up @@ -93,7 +93,18 @@ Directory to save the generated icons.

## Platforms

The supported platforms are `Android`, `iOS` and `BlackBerry 10`. Every platform generates a different set of icons.
The supported platforms are `PWA`, `Android`, `iOS` and `BlackBerry 10`. Every platform generates a different set of icons.

### PWA

- `icon-72x72.png`
- `icon-96x96.png`
- `icon-128x128.png`
- `icon-144x144.png`
- `icon-152x152.png`
- `icon-192x192.png`
- `icon-384x384.png`
- `icon-512x512.png`

### Android

Expand Down
13 changes: 13 additions & 0 deletions test.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,19 @@ test.beforeEach(t => {
t.context.tmp = tempfile();
});

test('pwa', async t => {
await fn('fixtures/icon.png', {platform: 'pwa', dest: t.context.tmp});

t.true(pathExists.sync(path.join(t.context.tmp, 'icon-72x72.png')));
t.true(pathExists.sync(path.join(t.context.tmp, 'icon-96x96.png')));
t.true(pathExists.sync(path.join(t.context.tmp, 'icon-128x128.png')));
t.true(pathExists.sync(path.join(t.context.tmp, 'icon-144x144.png')));
t.true(pathExists.sync(path.join(t.context.tmp, 'icon-152x152.png')));
t.true(pathExists.sync(path.join(t.context.tmp, 'icon-192x192.png')));
t.true(pathExists.sync(path.join(t.context.tmp, 'icon-384x384.png')));
t.true(pathExists.sync(path.join(t.context.tmp, 'icon-512x512.png')));
});

test('android', async t => {
await fn('fixtures/icon.png', {platform: 'android', dest: t.context.tmp});

Expand Down

0 comments on commit 4b6bcf1

Please sign in to comment.