Skip to content

Commit

Permalink
Meta tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
SamVerschueren committed Sep 6, 2019
1 parent 5881252 commit 5d051fe
Show file tree
Hide file tree
Showing 7 changed files with 85 additions and 87 deletions.
2 changes: 1 addition & 1 deletion .editorconfig
Expand Up @@ -7,6 +7,6 @@ charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

[{package.json,*.yml}]
[*.yml]
indent_style = space
indent_size = 2
1 change: 1 addition & 0 deletions .npmrc
@@ -0,0 +1 @@
package-lock=false
4 changes: 3 additions & 1 deletion .travis.yml
Expand Up @@ -3,5 +3,7 @@ before_install:
- sudo apt-get update
- sudo apt-get install graphicsmagick
node_js:
- '12'
- '10'
- '8'
- '6'
- '4'
34 changes: 22 additions & 12 deletions cli.js
Expand Up @@ -25,16 +25,26 @@ const cli = meow(`
$ mobicon icon.svg -p=ios -o=resources
✔ success
`, {
alias: {
p: 'platform',
b: 'background',
r: 'contentRatio',
o: 'out'
},
default: {
background: 'white',
contentRatio: 1,
out: process.cwd()
flags: {
platform: {
type: 'string',
alias: 'p'
},
background: {
type: 'string',
alias: 'b',
default: 'white'
},
contentRatio: {
type: 'number',
alias: 'r',
default: '1'
},
out: {
type: 'string',
alias: 'o',
default: process.cwd()
}
}
});

Expand Down Expand Up @@ -62,6 +72,6 @@ Promise.all(platforms.map(platform => {
return mobicon(cli.input[0], {platform, dest, background: cli.flags.background, contentRatio: cli.flags.contentRatio});
})).then(() => {
console.log(` ${logSymbols.success} success`);
}).catch(err => {
console.log(` ${logSymbols.error} ${chalk.bold.red('error')} ${err.message}`);
}).catch(error => {
console.log(` ${logSymbols.error} ${chalk.bold.red('error')} ${error.message}`);
});
18 changes: 3 additions & 15 deletions license
Expand Up @@ -2,20 +2,8 @@ The MIT License (MIT)

Copyright (c) Sam Verschueren <sam.verschueren@gmail.com> (github.com/SamVerschueren)

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
103 changes: 50 additions & 53 deletions package.json
@@ -1,55 +1,52 @@
{
"name": "mobicon-cli",
"version": "2.1.1",
"description": "Mobile app icon generator",
"license": "MIT",
"repository": "SamVerschueren/mobicon-cli",
"author": {
"name": "Sam Verschueren",
"email": "sam.verschueren@gmail.com",
"url": "github.com/SamVerschueren"
},
"bin": {
"mobicon": "cli.js"
},
"engines": {
"node": ">=4"
},
"scripts": {
"test": "xo && ava"
},
"files": [
"cli.js"
],
"keywords": [
"cli-app",
"cli",
"mobile",
"app",
"application",
"icon",
"generator",
"mobicon",
"cordova",
"android",
"ios",
"blackberry10"
],
"dependencies": {
"chalk": "^1.1.1",
"log-symbols": "^1.0.2",
"meow": "^3.6.0",
"mobicon": "^2.0.0",
"update-notifier": "^0.6.0"
},
"devDependencies": {
"ava": "*",
"execa": "^0.1.1",
"path-exists": "^2.1.0",
"tempfile": "^1.1.1",
"xo": "*"
},
"xo": {
"esnext": true
}
"name": "mobicon-cli",
"version": "2.1.1",
"description": "Mobile app icon generator",
"license": "MIT",
"repository": "SamVerschueren/mobicon-cli",
"author": {
"name": "Sam Verschueren",
"email": "sam.verschueren@gmail.com",
"url": "github.com/SamVerschueren"
},
"bin": {
"mobicon": "cli.js"
},
"engines": {
"node": ">=4"
},
"scripts": {
"test": "xo && ava"
},
"files": [
"cli.js"
],
"keywords": [
"cli-app",
"cli",
"mobile",
"app",
"application",
"icon",
"generator",
"mobicon",
"cordova",
"android",
"ios",
"blackberry10"
],
"dependencies": {
"chalk": "^1.1.1",
"log-symbols": "^1.0.2",
"meow": "^5.0.0",
"mobicon": "^2.0.0",
"update-notifier": "^0.6.0"
},
"devDependencies": {
"ava": "^2.3.0",
"execa": "^0.1.1",
"path-exists": "^2.1.0",
"tempfile": "^1.1.1",
"xo": "^0.24.0"
}
}
10 changes: 5 additions & 5 deletions test.js
Expand Up @@ -9,25 +9,25 @@ test.beforeEach(t => {
});

test('error', async t => {
await t.throws(execa('./cli.js'), /Please provide an input file/);
await t.throws(execa('./cli.js', ['fixtures/icon.png']), /Please provide at least one platform/);
await t.throwsAsync(() => execa('./cli.js'), /Please provide an input file/);
await t.throwsAsync(() => execa('./cli.js', ['fixtures/icon.png']), /Please provide at least one platform/);
});

test('png input', async t => {
await execa('./cli.js', ['fixtures/icon.png', '-p', 'android', '-o', t.context.tmp]);

t.true(pathExists.sync(path.join(t.context.tmp, 'drawable/icon.png')));
t.true(pathExists.sync(path.join(t.context.tmp, 'mipmap-hdpi/icon.png')));
});

test('svg input', async t => {
await execa('./cli.js', ['fixtures/icon.svg', '-p', 'android', '-o', t.context.tmp]);

t.true(pathExists.sync(path.join(t.context.tmp, 'drawable/icon.png')));
t.true(pathExists.sync(path.join(t.context.tmp, 'mipmap-hdpi/icon.png')));
});

test('multi platform', async t => {
await execa('./cli.js', ['fixtures/icon.png', '-p', 'android', '-p', 'ios', '-o', t.context.tmp]);

t.true(pathExists.sync(path.join(t.context.tmp, 'ios/icon.png')));
t.true(pathExists.sync(path.join(t.context.tmp, 'android/drawable/icon.png')));
t.true(pathExists.sync(path.join(t.context.tmp, 'android/mipmap-hdpi/icon.png')));
});

0 comments on commit 5d051fe

Please sign in to comment.