chore: upgrade image-size deps to v2 (#11065)

* upgrade image-size to v2

* fix resizeImage script

* fix tests
This commit is contained in:
Sébastien Lorber 2025-04-07 18:29:15 +02:00 committed by GitHub
parent 31b279fea6
commit b7ba0b54fb
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 14 additions and 24 deletions

View file

@ -9,9 +9,9 @@ import fs from 'fs-extra';
import path from 'path';
import {fileURLToPath} from 'url';
import {program} from 'commander';
import logger from '@docusaurus/logger';
import {logger} from '@docusaurus/logger';
import sharp from 'sharp';
import imageSize from 'image-size';
import {imageSizeFromFile} from 'image-size/fromFile';
// You can use it as:
//
@ -64,7 +64,7 @@ program
await Promise.all(
images.map(async (imgPath) => {
const {width, height} = imageSize(imgPath);
const {width, height} = await imageSizeFromFile(imgPath);
const targetWidth =
options.width ?? (imgPath.includes(showcasePath) ? 640 : 1000);
const targetHeight =