macos-defaults/record/dock
renovate[bot] 78d713f8ab
⬆️ Upgrade prettier to v3 (#306)
* ⬆️ Upgrade prettier to v3

* 🚨 Run prettier v3

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Yann Bertrand <5855339+yannbertrand@users.noreply.github.com>
2023-09-24 18:47:43 +02:00
..
autohide-delay ⬆️ Upgrade prettier to v3 (#306) 2023-09-24 18:47:43 +02:00
autohide-time-modifier ⬆️ Upgrade prettier to v3 (#306) 2023-09-24 18:47:43 +02:00
mineffect ⬆️ Upgrade prettier to v3 (#306) 2023-09-24 18:47:43 +02:00
orientation ⬆️ Upgrade prettier to v3 (#306) 2023-09-24 18:47:43 +02:00
show-recents ⬆️ Upgrade prettier to v3 (#306) 2023-09-24 18:47:43 +02:00
tilesize ⬆️ Upgrade prettier to v3 (#306) 2023-09-24 18:47:43 +02:00
readme.js ⬆️ Upgrade prettier to v3 (#306) 2023-09-24 18:47:43 +02:00

const MacRunner = require('../mac-runner')
const { compressPngImage } = require('../utils')

module.exports = {
  run: async (outputPath) => {
    console.log('> Recording dock readme screenshot')

    try {
      const { screenWidth, screenHeight } = MacRunner.getScreenSize()
      const dockHeight = MacRunner.getDockHeight()

      const runner = new MacRunner()
      await runner
        .captureScreenRect(
          0,
          screenHeight - dockHeight,
          screenWidth,
          dockHeight,
          `${outputPath}/dock-tmp.png`,
        )
        .run()
    } catch (runnerError) {
      throw new Error(runnerError)
    }

    try {
      await compressPngImage(`${outputPath}/dock-tmp.png`, outputPath, 'dock')
    } catch (compressPngImageError) {
      throw new Error(compressPngImageError)
    }

    return { filepath: `${outputPath}/dock` }
  },
}