From 5d051feac7d56e8587db626890ac59699c44f0ac Mon Sep 17 00:00:00 2001 From: Sam Verschueren Date: Fri, 6 Sep 2019 20:43:31 +0200 Subject: [PATCH] Meta tweaks --- .editorconfig | 2 +- .npmrc | 1 + .travis.yml | 4 +- cli.js | 34 +++++++++++------ license | 18 ++------- package.json | 103 ++++++++++++++++++++++++-------------------------- test.js | 10 ++--- 7 files changed, 85 insertions(+), 87 deletions(-) create mode 100644 .npmrc diff --git a/.editorconfig b/.editorconfig index 98a761d..1c6314a 100644 --- a/.editorconfig +++ b/.editorconfig @@ -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 diff --git a/.npmrc b/.npmrc new file mode 100644 index 0000000..43c97e7 --- /dev/null +++ b/.npmrc @@ -0,0 +1 @@ +package-lock=false diff --git a/.travis.yml b/.travis.yml index f00402e..4cef45c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,5 +3,7 @@ before_install: - sudo apt-get update - sudo apt-get install graphicsmagick node_js: + - '12' + - '10' + - '8' - '6' - - '4' diff --git a/cli.js b/cli.js index d6415e7..4ffaacd 100755 --- a/cli.js +++ b/cli.js @@ -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() + } } }); @@ -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}`); }); diff --git a/license b/license index 78b0855..57d1f37 100644 --- a/license +++ b/license @@ -2,20 +2,8 @@ The MIT License (MIT) Copyright (c) Sam Verschueren (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. diff --git a/package.json b/package.json index 190afd9..3ca1b98 100644 --- a/package.json +++ b/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" + } } diff --git a/test.js b/test.js index 76ad106..8da3cec 100644 --- a/test.js +++ b/test.js @@ -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'))); });