mirror of
https://github.com/facebook/docusaurus.git
synced 2025-05-28 16:37:07 +02:00
chore: upgrade image-size deps to v2 (#11065)
* upgrade image-size to v2 * fix resizeImage script * fix tests
This commit is contained in:
parent
31b279fea6
commit
b7ba0b54fb
7 changed files with 14 additions and 24 deletions
|
@ -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 =
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue