JamieMason / ImageOptim-CLI

Make optimisation of images part of your automated build process
https://foldleft.io/image-tools
MIT License
3.45k stars 125 forks source link

feat: add custom batch-sizing to cli options #200

Open troyxmccall opened 9 months ago

troyxmccall commented 9 months ago

Description (What)

added option for declaring custom batch sizes, ie: --batch-size 5 , if no option is specified, the batch defaults to the original 300 count

Justification (Why)

Older hardware experiences a regression of https://github.com/JamieMason/ImageOptim-CLI/issues/173

❯ imageoptim -V
3.1.9
❯ imageoptim .
i Running ImageOptim...
! stderr maxBuffer length exceeded

! Please raise an issue at https://github.com/JamieMason/ImageOptim-CLI/issues

    RangeError [ERR_CHILD_PROCESS_STDIO_MAXBUFFER]: stderr maxBuffer length exceeded
        at new NodeError (node:internal/errors:388:5)
        at Socket.onChildStderr (node:child_process:476:14)
        at Socket.emit (node:events:537:28)
        at addChunk (node:internal/streams/readable:324:12)
        at readableAddChunk (node:internal/streams/readable:293:11)
        at Readable.push (node:internal/streams/readable:234:10)
        at Pipe.onStreamRead (node:internal/stream_base_commons:190:23)

on

❯ neofetch 
                    'c.          admin@mac-mini.local 
                 ,xNMM.          ---------------------- 
               .OMMMMo           OS: macOS 12.7.1 21G920 x86_64 
               OMMM0,            Host: Macmini7,1 
     .;loddo:' loolloddol;.      Kernel: 21.6.0 
   cKMMMMMMMMMMNWMMMMMMMMMM0:    Uptime: 5 hours, 3 mins 
 .KMMMMMMMMMMMMMMMMMMMMMMMWd.    Packages: 185 (brew) 
 XMMMMMMMMMMMMMMMMMMMMMMMX.      Shell: bash 5.2.21 
;MMMMMMMMMMMMMMMMMMMMMMMM:       Resolution: 1920x1080 
:MMMMMMMMMMMMMMMMMMMMMMMM:       DE: Aqua 
.MMMMMMMMMMMMMMMMMMMMMMMMX.      WM: Quartz Compositor 
 kMMMMMMMMMMMMMMMMMMMMMMMMWd.    WM Theme: Blue (Dark) 
 .XMMMMMMMMMMMMMMMMMMMMMMMMMMk   Terminal: Apple_Terminal 
  .XMMMMMMMMMMMMMMMMMMMMMMMMK.   Terminal Font: SFMono-Regular 
    kMMMMMMMMMMMMMMMMMMMMMMd     CPU: Intel i5-4278U (4) @ 2.60GHz 
     ;KMMMMMMMWXXWMMMMMMMk.      GPU: Intel Iris 
       .cooc,.    .,coo:.        Memory: 5274MiB / 8192MiB 

How Can This Be Tested?

yarn build
./imageoptim --batch-size 10 ~/path/to/folder/
./imageoptim ~/path/to/another/folder/