auto-image-converter 1.0.10 → 1.0.11

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/bin/index.js CHANGED
@@ -2,15 +2,25 @@
2
2
  import path from "path";
3
3
  import { fileURLToPath, pathToFileURL } from "url";
4
4
  import { convertImages } from "../lib/converter.js";
5
- import fs from "fs/promises";
6
5
 
7
- const __dirname = path.dirname(fileURLToPath(import.meta.url));
8
6
  const CONFIG_PATH = path.resolve(process.cwd(), "image-converter.config.mjs");
9
7
 
10
8
  try {
11
9
  const configModule = await import(pathToFileURL(CONFIG_PATH).href);
12
10
  const config = configModule.default;
13
- await convertImages(config);
11
+
12
+ const absDir = path.resolve(
13
+ process.cwd(),
14
+ config.source || config.dir || "."
15
+ );
16
+
17
+ await convertImages({
18
+ dir: absDir,
19
+ format: config.targetFormat || config.format || "webp",
20
+ quality: config.quality ?? 80,
21
+ recursive: config.recursive ?? true,
22
+ removeOriginal: config.removeOriginal ?? false,
23
+ });
14
24
  } catch (e) {
15
25
  console.error("❌ Ошибка загрузки конфигурации:", e.message);
16
26
  process.exit(1);
package/lib/converter.js CHANGED
@@ -16,6 +16,8 @@ export async function convertImages({
16
16
  ? `${dir}/**/*.{png,jpg,jpeg}`
17
17
  : `${dir}/*.{png,jpg,jpeg}`;
18
18
  const files = await fg(pattern);
19
+ console.log("Ищу файлы по пути:", pattern);
20
+ console.log("Текущая директория:", process.cwd());
19
21
  console.log("нашел файлы", files);
20
22
 
21
23
  for (const file of files) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "auto-image-converter",
3
- "version": "1.0.10",
3
+ "version": "1.0.11",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "auto-convert-images": "./bin/index.js"