change-image-suffix 2.1.8 → 2.1.10

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/CHANGELOG.md CHANGED
@@ -2,6 +2,20 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
4
4
 
5
+ ### [2.1.10](https://github.com/GuoSirius/change-image-suffix/compare/v2.1.9...v2.1.10) (2026-05-25)
6
+
7
+
8
+ ### Bug Fixes
9
+
10
+ * rewrite bat to avoid all path manipulation, pass directly to cis ([6c262fa](https://github.com/GuoSirius/change-image-suffix/commit/6c262fa190c8a7f380c29b0319ef860364bf90af))
11
+
12
+ ### [2.1.9](https://github.com/GuoSirius/change-image-suffix/compare/v2.1.8...v2.1.9) (2026-05-25)
13
+
14
+
15
+ ### Bug Fixes
16
+
17
+ * replace bat if/else blocks with goto to handle paths with parentheses ([47cff5a](https://github.com/GuoSirius/change-image-suffix/commit/47cff5ad7d50b60f41628dd1fe9bcf869a74e85e))
18
+
5
19
  ### [2.1.8](https://github.com/GuoSirius/change-image-suffix/compare/v2.1.7...v2.1.8) (2026-05-25)
6
20
 
7
21
 
package/dist/index.js CHANGED
@@ -57,24 +57,19 @@ function installContextMenu() {
57
57
  }
58
58
  const iconPath = fs.existsSync(icoTarget) ? icoTarget : cisCmd;
59
59
  const batPath = path.join(appDataDir, 'cis_file.bat');
60
- // ── bat 脚本:接收格式 + 文件/目录路径,直接调用 cis ──
60
+ // ── bat 脚本:逐项调用 cis,不做 if exist/set 路径操作,避免 cmd.exe 对 () & 等字符解析出错 ──
61
61
  // %1 = 格式, %2 %3 ... = Windows 传入的文件/目录路径
62
62
  const batContent = `
63
63
  @echo off
64
64
  chcp 65001 >nul
65
- setlocal enabledelayedexpansion
65
+ setlocal
66
66
 
67
- REM Find cis command in PATH
67
+ REM Find cis command in PATH (take first match via goto)
68
68
  set "CIS_CMD="
69
- for /f "delims=" %%c in ('where cis.cmd 2^>nul') do (
70
- if "!CIS_CMD!"=="" set "CIS_CMD=%%c"
71
- )
72
- if "!CIS_CMD!"=="" (
73
- for /f "delims=" %%c in ('where cis 2^>nul') do (
74
- if "!CIS_CMD!"=="" set "CIS_CMD=%%c"
75
- )
76
- )
77
- if "!CIS_CMD!"=="" (
69
+ for /f "delims=" %%c in ('where cis.cmd 2^>nul') do set "CIS_CMD=%%c" & goto :cis_found
70
+ :cis_found
71
+ if "%CIS_CMD%"=="" for /f "delims=" %%c in ('where cis 2^>nul') do set "CIS_CMD=%%c" & goto :cis_found
72
+ if "%CIS_CMD%"=="" (
78
73
  echo [change-image-suffix] cis command not found. Run: npm install -g change-image-suffix
79
74
  pause
80
75
  exit /b 1
@@ -89,27 +84,22 @@ if "%~1"=="" (
89
84
  set "format=%~1"
90
85
  shift
91
86
 
92
- set args=
93
- :parse
94
- if "%~1"=="" goto :run
95
- if exist "%~1\\*" (
96
- set args=!args! -p "%~1"
97
- ) else (
98
- set args=!args! -f "%~1"
99
- )
100
- shift
101
- goto :parse
102
-
103
- :run
104
- if "!args!"=="" (
87
+ if "%~1"=="" (
105
88
  echo [change-image-suffix] No files or directories to process.
106
89
  pause
107
90
  exit /b 1
108
91
  )
109
92
 
110
- "!CIS_CMD!" -t !format! !args!
93
+ :process
94
+ if "%~1"=="" goto :done
95
+ "%CIS_CMD%" -t %format% "%~1"
96
+ shift
97
+ goto :process
98
+
99
+ :done
111
100
  pause
112
101
  endlocal
102
+ goto :eof
113
103
  `;
114
104
  fs.writeFileSync(batPath, batContent, 'utf8');
115
105
  // ── 格式列表(webp 排第一,其他按常见程度排序)──
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "change-image-suffix",
3
- "version": "2.1.8",
3
+ "version": "2.1.10",
4
4
  "type": "module",
5
5
  "description": "批量转换图片格式的CLI工具,支持递归搜索、深度限制、指定后缀、Windows右键菜单等功能",
6
6
  "main": "dist/index.js",