File tree Expand file tree Collapse file tree 1 file changed +5
-1
lines changed Expand file tree Collapse file tree 1 file changed +5
-1
lines changed Original file line number Diff line number Diff line change 11const { Jimp } = require ( 'jimp' ) ;
2+ const fs = require ( 'fs' ) ;
23
34const sizes = {
45 xxxhdpi : 192 ,
@@ -13,13 +14,16 @@ async function main(imageUrl) {
1314 const image = await Jimp . read ( imageUrl ) ;
1415 image . resize ( { w : 512 , h : 512 } ) . write ( 'app/src/main/ic_launcher-playstore.png' ) ;
1516 for ( const [ sizeName , sizePixels ] of Object . entries ( sizes ) ) {
17+ const mipmapFolder = `app/src/main/res/mipmap-${ sizeName } ` ;
18+ if ( ! fs . existsSync ( mipmapFolder ) ) {
19+ fs . mkdirSync ( mipmapFolder , { recursive : true } ) ;
20+ }
1621 const launcherPath = `app/src/main/res/mipmap-${ sizeName } /ic_launcher.png` ;
1722 const roundPath = `app/src/main/res/mipmap-${ sizeName } /ic_launcher_round.png` ;
1823 image . resize ( { w : sizePixels , h : sizePixels } ) . write ( launcherPath ) ;
1924 image . circle ( ) . write ( roundPath ) ;
2025 }
2126}
22-
2327if ( require . main === module ) {
2428 const arg = process . argv [ 2 ] ;
2529 if ( ! arg ) throw new Error ( 'missing argument' ) ;
You can’t perform that action at this time.
0 commit comments