auto-image-converter 1.1.7 → 1.1.9

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.
Files changed (2) hide show
  1. package/bin/watcher.mjs +4 -11
  2. package/package.json +1 -1
package/bin/watcher.mjs CHANGED
@@ -5,23 +5,16 @@ import { convertImages } from "../lib/converter.js";
5
5
  import { pathToFileURL } from "url";
6
6
 
7
7
  const configPath = path.resolve(process.cwd(), "image-converter.config.mjs");
8
-
9
- // Импортируем конфиг
10
8
  const config = (await import(pathToFileURL(configPath).href)).default;
11
9
 
12
- // Для наблюдения используем путь из конфига (fallback "public")
13
- const watchPath = config.dir
14
- ? path.posix.join(
15
- config.dir.split(path.sep).join(path.posix.sep),
16
- "**",
17
- "*.{png,jpg,jpeg}"
18
- )
19
- : "public/**/*.{png,jpg,jpeg}";
10
+ const watchDir = config.dir || "public";
11
+ const absWatchDir = path.resolve(process.cwd(), watchDir);
12
+ const watchPath = path.join(absWatchDir, "**", "*.{png,jpg,jpeg}");
20
13
 
21
14
  console.log(`👀 Watching for image changes on: ${watchPath}`);
22
15
 
23
16
  chokidar
24
- .watch(watchPath, { ignoreInitial: false })
17
+ .watch(watchPath, { ignoreInitial: true })
25
18
  .on("add", async (filePath) => {
26
19
  console.log(`➕ New image: ${filePath}`);
27
20
  try {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "auto-image-converter",
3
- "version": "1.1.7",
3
+ "version": "1.1.9",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "auto-convert-images": "./bin/index.js",