From e4bfa1eb33af8cfd946d003b6c3a5b7459359c7b Mon Sep 17 00:00:00 2001 From: Joe Reeve Date: Fri, 22 Feb 2019 15:36:34 +0100 Subject: [PATCH 1/2] :sparkles: Added mipmap ic-launcher png generation --- README.md | 9 ++- index.js | 12 ++-- package-lock.json | 170 ++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 184 insertions(+), 7 deletions(-) create mode 100644 package-lock.json diff --git a/README.md b/README.md index 93e176e..bf47210 100644 --- a/README.md +++ b/README.md @@ -50,7 +50,7 @@ For good results, your file should be: #### Notes: -- Your `config.ml` file will not be updated by the tool (because images are automatically created in the good folders) +- Your `config.xml` file will not be updated by the tool (because images are automatically created in the good folders) - Therefore, in your `config.xml`, be sure to remove all lines looking like `` ### Creating a cordova-cli hook @@ -72,6 +72,13 @@ Then give the script +x permission: That's it. Now every time you `cordova build`, the icons will be auto generated. +### Android Adaptive Icons +If you wish to use `png`s instead of adaptive icons, add the following to your hook: +``` +cordova-icon +rm -rf platforms/android/app/src/main/res/mipmap-*-v26 +``` + ### Splash screens Check out [cordova-splash](https://github.com/AlexDisler/cordova-splash) diff --git a/index.js b/index.js index b83ef55..0b1b5aa 100644 --- a/index.js +++ b/index.js @@ -78,12 +78,12 @@ var getPlatforms = function (projectName) { { name : 'drawable-xhdpi/icon.png', size : 96 }, { name : 'drawable-xxhdpi/icon.png', size : 144 }, { name : 'drawable-xxxhdpi/icon.png', size : 192 }, - { name : 'mipmap-hdpi/icon.png', size : 72 }, - { name : 'mipmap-ldpi/icon.png', size : 36 }, - { name : 'mipmap-mdpi/icon.png', size : 48 }, - { name : 'mipmap-xhdpi/icon.png', size : 96 }, - { name : 'mipmap-xxhdpi/icon.png', size : 144 }, - { name : 'mipmap-xxxhdpi/icon.png', size : 192 } + { name : 'mipmap-hdpi/ic-launcher.png', size : 72 }, + { name : 'mipmap-ldpi/ic-launcher.png', size : 36 }, + { name : 'mipmap-mdpi/ic-launcher.png', size : 48 }, + { name : 'mipmap-xhdpi/ic-launcher.png', size : 96 }, + { name : 'mipmap-xxhdpi/ic-launcher.png', size : 144 }, + { name : 'mipmap-xxxhdpi/ic-launcher.png', size : 192 } ] }); platforms.push({ diff --git a/package-lock.json b/package-lock.json new file mode 100644 index 0000000..37058eb --- /dev/null +++ b/package-lock.json @@ -0,0 +1,170 @@ +{ + "name": "cordova-icon", + "version": "1.0.0", + "lockfileVersion": 1, + "requires": true, + "dependencies": { + "balanced-match": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", + "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=" + }, + "brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "requires": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "colors": { + "version": "0.6.2", + "resolved": "https://registry.npmjs.org/colors/-/colors-0.6.2.tgz", + "integrity": "sha1-JCP+ZnisDF2uiFLl0OW+CMmXq8w=" + }, + "concat-map": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", + "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=" + }, + "fs-extra": { + "version": "0.30.0", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-0.30.0.tgz", + "integrity": "sha1-8jP/zAjU2n1DLapEl3aYnbHfk/A=", + "requires": { + "graceful-fs": "^4.1.2", + "jsonfile": "^2.1.0", + "klaw": "^1.0.0", + "path-is-absolute": "^1.0.0", + "rimraf": "^2.2.8" + } + }, + "fs.realpath": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", + "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=" + }, + "glob": { + "version": "7.1.3", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.3.tgz", + "integrity": "sha512-vcfuiIxogLV4DlGBHIUOwI0IbrJ8HWPc4MU7HzviGeNho/UJDfi6B5p3sHeWIQ0KGIU0Jpxi5ZHxemQfLkkAwQ==", + "requires": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.0.4", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + } + }, + "graceful-fs": { + "version": "4.1.15", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.1.15.tgz", + "integrity": "sha512-6uHUhOPEBgQ24HM+r6b/QwWfZq+yiFcipKFrOFiBEnWdy5sdzYoi+pJeQaPI5qOLRFqWmAXUPQNsielzdLoecA==" + }, + "imagemagick": { + "version": "0.1.3", + "resolved": "https://registry.npmjs.org/imagemagick/-/imagemagick-0.1.3.tgz", + "integrity": "sha1-dIPOoJO02fLi85aFetyIIbU3xWo=" + }, + "inflight": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", + "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", + "requires": { + "once": "^1.3.0", + "wrappy": "1" + } + }, + "inherits": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", + "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=" + }, + "jsonfile": { + "version": "2.4.0", + "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-2.4.0.tgz", + "integrity": "sha1-NzaitCi4e72gzIO1P6PWM6NcKug=", + "requires": { + "graceful-fs": "^4.1.6" + } + }, + "klaw": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/klaw/-/klaw-1.3.1.tgz", + "integrity": "sha1-QIhDO0azsbolnXh4XY6W9zugJDk=", + "requires": { + "graceful-fs": "^4.1.9" + } + }, + "minimatch": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", + "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", + "requires": { + "brace-expansion": "^1.1.7" + } + }, + "minimist": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz", + "integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=" + }, + "once": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", + "requires": { + "wrappy": "1" + } + }, + "path-is-absolute": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", + "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=" + }, + "q": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/q/-/q-1.5.1.tgz", + "integrity": "sha1-fjL3W0E4EpHQRhHxvxQQmsAGUdc=" + }, + "rimraf": { + "version": "2.6.3", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.6.3.tgz", + "integrity": "sha512-mwqeW5XsA2qAejG46gYdENaxXjx9onRNCfn7L0duuP4hCuTIi/QO7PDK07KJfp1d+izWPrzEJDcSqBa0OZQriA==", + "requires": { + "glob": "^7.1.3" + } + }, + "sax": { + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/sax/-/sax-1.2.4.tgz", + "integrity": "sha512-NqVDv9TpANUjFm0N8uM5GxL36UgKi9/atZw+x7YFnQ8ckwFGKrl4xX4yWtrey3UJm5nP1kUbnYgLopqWNSRhWw==" + }, + "underscore": { + "version": "1.9.1", + "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.9.1.tgz", + "integrity": "sha512-5/4etnCkd9c8gwgowi5/om/mYO5ajCaOgdzj/oW+0eQV9WxKBDZw5+ycmKmeaTXjInS/W0BzpGLo2xR2aBwZdg==" + }, + "wrappy": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=" + }, + "xml2js": { + "version": "0.4.19", + "resolved": "https://registry.npmjs.org/xml2js/-/xml2js-0.4.19.tgz", + "integrity": "sha512-esZnJZJOiJR9wWKMyuvSE1y6Dq5LCuJanqhxslH2bxM6duahNZ+HMpCLhBQGZkbX6xRf8x1Y2eJlgt2q3qo49Q==", + "requires": { + "sax": ">=0.6.0", + "xmlbuilder": "~9.0.1" + } + }, + "xmlbuilder": { + "version": "9.0.7", + "resolved": "https://registry.npmjs.org/xmlbuilder/-/xmlbuilder-9.0.7.tgz", + "integrity": "sha1-Ey7mPS7FVlxVfiD0wi35rKaGsQ0=" + } + } +} From 4e778e8cd0263b20cab24262c71cdad11444d9bc Mon Sep 17 00:00:00 2001 From: Joe Reeve Date: Fri, 22 Feb 2019 15:41:09 +0100 Subject: [PATCH 2/2] :bug: Fix hypen issue --- index.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/index.js b/index.js index 0b1b5aa..03ec0c0 100644 --- a/index.js +++ b/index.js @@ -78,12 +78,12 @@ var getPlatforms = function (projectName) { { name : 'drawable-xhdpi/icon.png', size : 96 }, { name : 'drawable-xxhdpi/icon.png', size : 144 }, { name : 'drawable-xxxhdpi/icon.png', size : 192 }, - { name : 'mipmap-hdpi/ic-launcher.png', size : 72 }, - { name : 'mipmap-ldpi/ic-launcher.png', size : 36 }, - { name : 'mipmap-mdpi/ic-launcher.png', size : 48 }, - { name : 'mipmap-xhdpi/ic-launcher.png', size : 96 }, - { name : 'mipmap-xxhdpi/ic-launcher.png', size : 144 }, - { name : 'mipmap-xxxhdpi/ic-launcher.png', size : 192 } + { name : 'mipmap-hdpi/ic_launcher.png', size : 72 }, + { name : 'mipmap-ldpi/ic_launcher.png', size : 36 }, + { name : 'mipmap-mdpi/ic_launcher.png', size : 48 }, + { name : 'mipmap-xhdpi/ic_launcher.png', size : 96 }, + { name : 'mipmap-xxhdpi/ic_launcher.png', size : 144 }, + { name : 'mipmap-xxxhdpi/ic_launcher.png', size : 192 } ] }); platforms.push({