auto-image-converter 1.0.15 → 1.0.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/converter.js +5 -1
- package/package.json +1 -1
package/lib/converter.js
CHANGED
|
@@ -2,6 +2,7 @@ import fg from "fast-glob";
|
|
|
2
2
|
import sharp from "sharp";
|
|
3
3
|
import fs from "node:fs/promises";
|
|
4
4
|
import path from "node:path";
|
|
5
|
+
import { convertPathToPosix } from "fast-glob/out/utils/path";
|
|
5
6
|
|
|
6
7
|
const supportedExt = [".png", ".jpg", ".jpeg"];
|
|
7
8
|
|
|
@@ -12,9 +13,12 @@ export async function convertImages({
|
|
|
12
13
|
recursive,
|
|
13
14
|
removeOriginal,
|
|
14
15
|
}) {
|
|
15
|
-
const
|
|
16
|
+
const rawPattern = recursive
|
|
16
17
|
? path.join(dir, "**", "*.{png,jpg,jpeg}")
|
|
17
18
|
: path.join(dir, "*.{png,jpg,jpeg}");
|
|
19
|
+
|
|
20
|
+
// Преобразуем \ → /
|
|
21
|
+
const pattern = convertPathToPosix(rawPattern);
|
|
18
22
|
console.log("Ищу файлы по пути:", pattern);
|
|
19
23
|
const files = await fg(pattern, { caseSensitiveMatch: false });
|
|
20
24
|
console.log("Текущая директория:", process.cwd());
|