zen-gitsync 2.7.16 → 2.8.1

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.
@@ -0,0 +1,180 @@
1
+ # CSS 样式变量标准化工具
2
+
3
+ ## 功能说明
4
+
5
+ 该脚本将项目中的 `border-radius` 和 `box-shadow` 值转换为标准的 CSS 变量引用。
6
+
7
+ ## 转换规则
8
+
9
+ ### border-radius 映射
10
+
11
+ | 原始值 | 转换后 | CSS变量定义 |
12
+ |--------|--------|-------------|
13
+ | 2px | var(--radius-xs) | 2px |
14
+ | 3px | var(--radius-sm) | 3px |
15
+ | 4px | var(--radius-base) | 4px |
16
+ | 6px | var(--radius-md) | 6px |
17
+ | 8px | var(--radius-lg) | 8px |
18
+ | 12px | var(--radius-xl) | 12px |
19
+
20
+ ### box-shadow 映射
21
+
22
+ | 原始值 | 转换后 | 用途 |
23
+ |--------|--------|------|
24
+ | 0 1px 3px rgba(0, 0, 0, 0.04) | var(--shadow-sm) | 小阴影 |
25
+ | 0 1px 4px rgba(0, 0, 0, 0.04) | var(--shadow-base) | 基础阴影 |
26
+ | 0 2px 8px rgba(0, 0, 0, 0.08) | var(--shadow-md) | 中等阴影 |
27
+ | 0 4px 12px rgba(0, 0, 0, 0.08) | var(--shadow-lg) | 大阴影 |
28
+ | 0 8px 24px rgba(0, 0, 0, 0.12) | var(--shadow-xl) | 超大阴影 |
29
+
30
+ #### 模糊匹配规则
31
+
32
+ 对于未精确匹配的 box-shadow 值,脚本会根据偏移量和模糊度智能选择:
33
+
34
+ - **小阴影** (--shadow-sm): offset ≤ 2px, blur ≤ 4px
35
+ - **中等阴影** (--shadow-md): offset 2-4px, blur 6-12px
36
+ - **大阴影** (--shadow-lg): offset 4-8px, blur 12-24px
37
+
38
+ ## 使用方法
39
+
40
+ ### 预览模式(推荐先运行)
41
+
42
+ ```bash
43
+ # 预览将要进行的更改,不修改文件
44
+ node scripts/convert-to-standard-vars.js --dry-run
45
+ ```
46
+
47
+ ### 实际应用
48
+
49
+ ```bash
50
+ # 应用更改到文件
51
+ node scripts/convert-to-standard-vars.js
52
+ ```
53
+
54
+ ## 转换示例
55
+
56
+ ### border-radius 转换
57
+
58
+ **转换前:**
59
+ ```css
60
+ .card {
61
+ border-radius: 8px;
62
+ }
63
+
64
+ .button {
65
+ border-radius: 6px;
66
+ }
67
+ ```
68
+
69
+ **转换后:**
70
+ ```css
71
+ .card {
72
+ border-radius: var(--radius-lg);
73
+ }
74
+
75
+ .button {
76
+ border-radius: var(--radius-md);
77
+ }
78
+ ```
79
+
80
+ ### box-shadow 转换
81
+
82
+ **转换前:**
83
+ ```css
84
+ .card {
85
+ box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
86
+ }
87
+
88
+ .modal {
89
+ box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
90
+ }
91
+ ```
92
+
93
+ **转换后:**
94
+ ```css
95
+ .card {
96
+ box-shadow: var(--shadow-md);
97
+ }
98
+
99
+ .modal {
100
+ box-shadow: var(--shadow-lg);
101
+ }
102
+ ```
103
+
104
+ ## 支持的文件类型
105
+
106
+ - `.vue` - Vue 单文件组件
107
+ - `.scss` - Sass 样式文件
108
+ - `.css` - 纯 CSS 文件
109
+
110
+ ## 扫描范围
111
+
112
+ 脚本会扫描 `src` 目录下的所有目标文件,自动跳过:
113
+ - `node_modules` 目录
114
+ - `.git` 目录
115
+ - `dist` 目录
116
+
117
+ ## 输出报告
118
+
119
+ 执行完成后会显示详细的统计报告:
120
+
121
+ ```
122
+ 📊 转换统计报告
123
+ ============================================================
124
+ 总文件数: 150
125
+ 修改文件数: 38
126
+ border-radius 替换次数: 67
127
+ box-shadow 替换次数: 42
128
+
129
+ 📋 border-radius 替换详情:
130
+ 8px => var(--radius-lg): 28 次
131
+ 6px => var(--radius-md): 19 次
132
+ 4px => var(--radius-base): 12 次
133
+ ...
134
+
135
+ 📋 box-shadow 替换详情:
136
+ 0 2px 8px rgba(0, 0, 0, 0.08) => var(--shadow-md): 23 次
137
+ 0 4px 12px rgba(0, 0, 0, 0.08) => var(--shadow-lg): 15 次
138
+ ...
139
+ ```
140
+
141
+ ## 注意事项
142
+
143
+ 1. **备份建议**:运行脚本前建议先使用 `--dry-run` 参数预览更改
144
+ 2. **Git 提交**:建议在运行前提交当前代码,方便回滚
145
+ 3. **检查结果**:转换完成后请检查 Git diff,确认转换符合预期
146
+ 4. **测试验证**:转换后请运行项目测试,确保样式显示正常
147
+
148
+ ## 优势
149
+
150
+ 使用 CSS 变量的好处:
151
+
152
+ 1. **统一管理**:所有样式值在 `variables.scss` 中统一定义
153
+ 2. **易于维护**:修改变量值即可全局更新
154
+ 3. **主题支持**:方便实现深色主题等样式变体
155
+ 4. **语义化**:变量名更具可读性
156
+ 5. **一致性**:确保整个项目使用统一的设计规范
157
+
158
+ ## 回滚方法
159
+
160
+ 如果需要回滚更改:
161
+
162
+ ```bash
163
+ # 如果还未提交
164
+ git checkout -- src/
165
+
166
+ # 如果已提交
167
+ git revert <commit-hash>
168
+ ```
169
+
170
+ ## 组合使用
171
+
172
+ 该脚本可以与间距转换脚本配合使用,实现完整的样式标准化:
173
+
174
+ ```bash
175
+ # 1. 转换间距值
176
+ node scripts/convert-spacing-to-vars.js
177
+
178
+ # 2. 转换圆角和阴影
179
+ node scripts/convert-to-standard-vars.js
180
+ ```
@@ -0,0 +1,272 @@
1
+ /**
2
+ * 将项目中硬编码的颜色值转换为 CSS 变量
3
+ *
4
+ * 根据 variables.scss 中定义的颜色变量进行映射
5
+ *
6
+ * 使用方式:
7
+ * node scripts/convert-colors-to-vars.cjs [--dry-run]
8
+ *
9
+ * --dry-run: 预览模式,不实际修改文件
10
+ */
11
+
12
+ const fs = require('fs');
13
+ const path = require('path');
14
+
15
+ // 获取命令行参数
16
+ const args = process.argv.slice(2);
17
+ const isDryRun = args.includes('--dry-run');
18
+
19
+ // 颜色映射表(基于 variables.scss)
20
+ const COLOR_MAP = {
21
+ // 主色调
22
+ '#409eff': 'var(--color-primary)',
23
+ '#5a67d8': 'var(--color-primary-light)',
24
+ '#337ecc': 'var(--color-primary-dark)',
25
+ '#66b1ff': 'var(--color-primary-light)',
26
+ '#a0cfff': 'var(--color-primary-light)',
27
+
28
+ // 成功色
29
+ '#67c23a': 'var(--color-success)',
30
+ '#10b981': 'var(--color-success-light)',
31
+ '#85ce61': 'var(--color-success)',
32
+ '#b3e19d': 'var(--color-success)',
33
+
34
+ // 警告色
35
+ '#e6a23c': 'var(--color-warning)',
36
+ '#f59e0b': 'var(--color-warning-light)',
37
+ '#ebb563': 'var(--color-warning)',
38
+ '#f3d19e': 'var(--color-warning)',
39
+
40
+ // 危险色
41
+ '#f56c6c': 'var(--color-danger)',
42
+ '#ef4444': 'var(--color-danger-light)',
43
+ '#dc2626': 'var(--color-danger-dark)',
44
+ '#f78989': 'var(--color-danger)',
45
+
46
+ // 信息色
47
+ '#909399': 'var(--color-info)',
48
+ '#8b5cf6': 'var(--color-info-light)',
49
+
50
+ // 基础颜色
51
+ '#ffffff': 'var(--color-white)',
52
+ '#fff': 'var(--color-white)',
53
+ '#000000': 'var(--color-black)',
54
+ '#000': 'var(--color-black)',
55
+
56
+ // 灰色系列
57
+ '#f9fafb': 'var(--color-gray-50)',
58
+ '#f3f4f6': 'var(--color-gray-100)',
59
+ '#e5e7eb': 'var(--color-gray-200)',
60
+ '#d1d5db': 'var(--color-gray-300)',
61
+ '#9ca3af': 'var(--color-gray-400)',
62
+ '#6b7280': 'var(--color-gray-500)',
63
+ '#4b5563': 'var(--color-gray-600)',
64
+ '#374151': 'var(--color-gray-700)',
65
+ '#1f2937': 'var(--color-gray-800)',
66
+ '#111827': 'var(--color-gray-900)',
67
+
68
+ // 文字颜色
69
+ '#303133': 'var(--text-primary)',
70
+ '#606266': 'var(--text-secondary)',
71
+ '#909399': 'var(--text-tertiary)',
72
+ '#c0c4cc': 'var(--text-placeholder)',
73
+ '#a8abb2': 'var(--text-placeholder)',
74
+
75
+ // Git 状态颜色
76
+ '#10b981': 'var(--git-status-added)',
77
+ '#f59e0b': 'var(--git-status-modified)',
78
+ '#ef4444': 'var(--git-status-deleted)',
79
+ '#8b5cf6': 'var(--git-status-untracked)',
80
+ '#f97316': 'var(--git-status-conflicted)',
81
+
82
+ // 背景色(特殊)
83
+ '#f5f5f5': 'var(--bg-page)',
84
+ '#f8fafc': 'var(--bg-container-hover)',
85
+ '#2d2d2d': 'var(--bg-code-dark)',
86
+ '#f6f8fa': 'var(--bg-code)',
87
+
88
+ // 其他常见颜色
89
+ '#f8faff': '#f8faff', // 特殊渐变色,暂时保留
90
+ '#eef4ff': '#eef4ff',
91
+ '#fff2e6': '#fff2e6',
92
+ '#f8f8f2': '#f8f8f2',
93
+ };
94
+
95
+ // 需要处理的文件扩展名
96
+ const TARGET_EXTENSIONS = ['.vue', '.scss', '.css'];
97
+
98
+ // 需要跳过的文件
99
+ const SKIP_FILES = ['variables.scss', 'dark-theme.scss'];
100
+
101
+ // 统计信息
102
+ let stats = {
103
+ totalFiles: 0,
104
+ modifiedFiles: 0,
105
+ totalReplacements: 0,
106
+ replacementDetails: {},
107
+ skippedColors: new Set(),
108
+ };
109
+
110
+ console.log(`\n运行模式: ${isDryRun ? '预览模式(不会修改文件)' : '修改模式'}\n`);
111
+
112
+ /**
113
+ * 递归扫描目录
114
+ */
115
+ function scanDirectory(dir, fileList = []) {
116
+ const files = fs.readdirSync(dir);
117
+
118
+ files.forEach(file => {
119
+ const filePath = path.join(dir, file);
120
+ const stat = fs.statSync(filePath);
121
+
122
+ if (stat.isDirectory()) {
123
+ if (file !== 'node_modules' && file !== '.git' && file !== 'dist') {
124
+ scanDirectory(filePath, fileList);
125
+ }
126
+ } else {
127
+ const ext = path.extname(file);
128
+ if (TARGET_EXTENSIONS.includes(ext) && !SKIP_FILES.includes(file)) {
129
+ fileList.push(filePath);
130
+ }
131
+ }
132
+ });
133
+
134
+ return fileList;
135
+ }
136
+
137
+ /**
138
+ * 规范化颜色值(统一为小写)
139
+ */
140
+ function normalizeColor(color) {
141
+ return color.toLowerCase();
142
+ }
143
+
144
+ /**
145
+ * 处理文件内容
146
+ */
147
+ function processFileContent(content, filePath) {
148
+ let modified = false;
149
+ let newContent = content;
150
+
151
+ // 匹配 6位 和 3位 十六进制颜色
152
+ const colorRegex = /#([0-9a-fA-F]{6}|[0-9a-fA-F]{3})\b/g;
153
+
154
+ newContent = newContent.replace(colorRegex, (match) => {
155
+ const normalizedColor = normalizeColor(match);
156
+
157
+ // 如果是3位颜色,展开为6位
158
+ let expandedColor = normalizedColor;
159
+ if (normalizedColor.length === 4) {
160
+ expandedColor = '#' + normalizedColor[1] + normalizedColor[1] +
161
+ normalizedColor[2] + normalizedColor[2] +
162
+ normalizedColor[3] + normalizedColor[3];
163
+ }
164
+
165
+ // 查找映射
166
+ const mappedVar = COLOR_MAP[normalizedColor] || COLOR_MAP[expandedColor];
167
+
168
+ if (mappedVar && mappedVar !== match) {
169
+ // 记录替换
170
+ stats.replacementDetails[match] = (stats.replacementDetails[match] || 0) + 1;
171
+ stats.totalReplacements++;
172
+ modified = true;
173
+ return mappedVar;
174
+ } else if (!mappedVar) {
175
+ // 记录未映射的颜色
176
+ stats.skippedColors.add(match);
177
+ }
178
+
179
+ return match;
180
+ });
181
+
182
+ return { content: newContent, modified };
183
+ }
184
+
185
+ /**
186
+ * 处理单个文件
187
+ */
188
+ function processFile(filePath) {
189
+ try {
190
+ const content = fs.readFileSync(filePath, 'utf8');
191
+ const { content: newContent, modified } = processFileContent(content, filePath);
192
+
193
+ if (modified) {
194
+ if (!isDryRun) {
195
+ fs.writeFileSync(filePath, newContent, 'utf8');
196
+ }
197
+ stats.modifiedFiles++;
198
+ console.log(`${isDryRun ? '📋 [预览]' : '✅'} ${filePath}`);
199
+ return true;
200
+ }
201
+
202
+ return false;
203
+ } catch (error) {
204
+ console.error(`❌ 处理文件失败: ${filePath}`, error.message);
205
+ return false;
206
+ }
207
+ }
208
+
209
+ /**
210
+ * 主函数
211
+ */
212
+ function main() {
213
+ const projectRoot = path.join(__dirname, '..');
214
+ const srcDir = path.join(projectRoot, 'src');
215
+
216
+ console.log('🚀 开始扫描并转换颜色值...\n');
217
+ console.log(`📁 项目根目录: ${projectRoot}`);
218
+ console.log(`📁 扫描目录: ${srcDir}\n`);
219
+
220
+ // 扫描所有目标文件
221
+ const files = scanDirectory(srcDir);
222
+ stats.totalFiles = files.length;
223
+
224
+ console.log(`📊 找到 ${files.length} 个文件需要检查\n`);
225
+ console.log('🔄 开始处理文件...\n');
226
+
227
+ // 处理每个文件
228
+ files.forEach(file => {
229
+ processFile(file);
230
+ });
231
+
232
+ // 输出统计信息
233
+ console.log('\n' + '='.repeat(60));
234
+ console.log('📊 转换统计报告');
235
+ console.log('='.repeat(60));
236
+ console.log(`总文件数: ${stats.totalFiles}`);
237
+ console.log(`修改文件数: ${stats.modifiedFiles}`);
238
+ console.log(`总替换次数: ${stats.totalReplacements}`);
239
+
240
+ if (Object.keys(stats.replacementDetails).length > 0) {
241
+ console.log('\n📋 替换详情:');
242
+ Object.entries(stats.replacementDetails)
243
+ .sort((a, b) => b[1] - a[1])
244
+ .forEach(([color, count]) => {
245
+ const varName = COLOR_MAP[color.toLowerCase()];
246
+ console.log(` ${color} => ${varName}: ${count} 次`);
247
+ });
248
+ }
249
+
250
+ if (stats.skippedColors.size > 0) {
251
+ console.log('\n⚠️ 未映射的颜色(需要手动检查):');
252
+ Array.from(stats.skippedColors)
253
+ .sort()
254
+ .forEach(color => {
255
+ console.log(` ${color}`);
256
+ });
257
+ }
258
+
259
+ if (isDryRun) {
260
+ console.log('\n💡 提示: 这是预览模式,文件未被修改');
261
+ console.log(' 移除 --dry-run 参数以实际应用更改');
262
+ } else {
263
+ console.log('\n✨ 转换完成!');
264
+ }
265
+ }
266
+
267
+ // 运行主函数
268
+ if (require.main === module) {
269
+ main();
270
+ }
271
+
272
+ module.exports = { processFileContent };
@@ -0,0 +1,207 @@
1
+ /**
2
+ * 将项目中硬编码的 font-size 值转换为 CSS 变量
3
+ *
4
+ * 根据 variables.scss 中定义的字体大小变量进行映射
5
+ *
6
+ * 使用方式:
7
+ * node scripts/convert-fontsize-to-vars.cjs [--dry-run]
8
+ *
9
+ * --dry-run: 预览模式,不实际修改文件
10
+ */
11
+
12
+ const fs = require('fs');
13
+ const path = require('path');
14
+
15
+ // 获取命令行参数
16
+ const args = process.argv.slice(2);
17
+ const isDryRun = args.includes('--dry-run');
18
+
19
+ // 字体大小映射表(基于 variables.scss)
20
+ const FONT_SIZE_MAP = {
21
+ '10px': 'var(--font-size-xs)',
22
+ '12px': 'var(--font-size-sm)',
23
+ '13px': 'var(--font-size-sm)', // 13px 映射到 sm (12px)
24
+ '14px': 'var(--font-size-base)',
25
+ '15px': 'var(--font-size-base)', // 15px 映射到 base (14px)
26
+ '16px': 'var(--font-size-md)',
27
+ '18px': 'var(--font-size-lg)',
28
+ '20px': 'var(--font-size-xl)',
29
+ '22px': 'var(--font-size-2xl)',
30
+ '24px': 'var(--font-size-3xl)',
31
+
32
+ // rem 单位映射
33
+ '0.625rem': 'var(--font-size-xs)', // 10px
34
+ '0.75rem': 'var(--font-size-sm)', // 12px
35
+ '0.875rem': 'var(--font-size-base)', // 14px
36
+ '1rem': 'var(--font-size-md)', // 16px
37
+ '1.125rem': 'var(--font-size-lg)', // 18px
38
+ '1.25rem': 'var(--font-size-xl)', // 20px
39
+ '1.375rem': 'var(--font-size-2xl)', // 22px
40
+ '1.5rem': 'var(--font-size-3xl)', // 24px
41
+ };
42
+
43
+ // 需要处理的文件扩展名
44
+ const TARGET_EXTENSIONS = ['.vue', '.scss', '.css'];
45
+
46
+ // 需要跳过的文件
47
+ const SKIP_FILES = ['variables.scss', 'dark-theme.scss'];
48
+
49
+ // 统计信息
50
+ let stats = {
51
+ totalFiles: 0,
52
+ modifiedFiles: 0,
53
+ totalReplacements: 0,
54
+ replacementDetails: {},
55
+ skippedSizes: new Set(),
56
+ };
57
+
58
+ console.log(`\n运行模式: ${isDryRun ? '预览模式(不会修改文件)' : '修改模式'}\n`);
59
+
60
+ /**
61
+ * 递归扫描目录
62
+ */
63
+ function scanDirectory(dir, fileList = []) {
64
+ const files = fs.readdirSync(dir);
65
+
66
+ files.forEach(file => {
67
+ const filePath = path.join(dir, file);
68
+ const stat = fs.statSync(filePath);
69
+
70
+ if (stat.isDirectory()) {
71
+ if (file !== 'node_modules' && file !== '.git' && file !== 'dist') {
72
+ scanDirectory(filePath, fileList);
73
+ }
74
+ } else {
75
+ const ext = path.extname(file);
76
+ if (TARGET_EXTENSIONS.includes(ext) && !SKIP_FILES.includes(file)) {
77
+ fileList.push(filePath);
78
+ }
79
+ }
80
+ });
81
+
82
+ return fileList;
83
+ }
84
+
85
+ /**
86
+ * 处理文件内容
87
+ */
88
+ function processFileContent(content, filePath) {
89
+ let modified = false;
90
+ let newContent = content;
91
+
92
+ // 匹配 font-size 属性
93
+ // 支持 px 和 rem 单位
94
+ const fontSizeRegex = /(\bfont-size\s*:\s*)(\d+(?:\.\d+)?(?:px|rem))\b/g;
95
+
96
+ newContent = newContent.replace(fontSizeRegex, (match, prefix, value) => {
97
+ const mappedVar = FONT_SIZE_MAP[value];
98
+
99
+ if (mappedVar && mappedVar !== value) {
100
+ // 记录替换
101
+ stats.replacementDetails[value] = (stats.replacementDetails[value] || 0) + 1;
102
+ stats.totalReplacements++;
103
+ modified = true;
104
+ return prefix + mappedVar;
105
+ } else if (!mappedVar) {
106
+ // 记录未映射的字体大小
107
+ stats.skippedSizes.add(value);
108
+ }
109
+
110
+ return match;
111
+ });
112
+
113
+ return { content: newContent, modified };
114
+ }
115
+
116
+ /**
117
+ * 处理单个文件
118
+ */
119
+ function processFile(filePath) {
120
+ try {
121
+ const content = fs.readFileSync(filePath, 'utf8');
122
+ const { content: newContent, modified } = processFileContent(content, filePath);
123
+
124
+ if (modified) {
125
+ if (!isDryRun) {
126
+ fs.writeFileSync(filePath, newContent, 'utf8');
127
+ }
128
+ stats.modifiedFiles++;
129
+ console.log(`${isDryRun ? '📋 [预览]' : '✅'} ${filePath}`);
130
+ return true;
131
+ }
132
+
133
+ return false;
134
+ } catch (error) {
135
+ console.error(`❌ 处理文件失败: ${filePath}`, error.message);
136
+ return false;
137
+ }
138
+ }
139
+
140
+ /**
141
+ * 主函数
142
+ */
143
+ function main() {
144
+ const projectRoot = path.join(__dirname, '..');
145
+ const srcDir = path.join(projectRoot, 'src');
146
+
147
+ console.log('🚀 开始扫描并转换 font-size 值...\n');
148
+ console.log(`📁 项目根目录: ${projectRoot}`);
149
+ console.log(`📁 扫描目录: ${srcDir}\n`);
150
+
151
+ // 扫描所有目标文件
152
+ const files = scanDirectory(srcDir);
153
+ stats.totalFiles = files.length;
154
+
155
+ console.log(`📊 找到 ${files.length} 个文件需要检查\n`);
156
+ console.log('🔄 开始处理文件...\n');
157
+
158
+ // 处理每个文件
159
+ files.forEach(file => {
160
+ processFile(file);
161
+ });
162
+
163
+ // 输出统计信息
164
+ console.log('\n' + '='.repeat(60));
165
+ console.log('📊 转换统计报告');
166
+ console.log('='.repeat(60));
167
+ console.log(`总文件数: ${stats.totalFiles}`);
168
+ console.log(`修改文件数: ${stats.modifiedFiles}`);
169
+ console.log(`总替换次数: ${stats.totalReplacements}`);
170
+
171
+ if (Object.keys(stats.replacementDetails).length > 0) {
172
+ console.log('\n📋 替换详情:');
173
+ Object.entries(stats.replacementDetails)
174
+ .sort((a, b) => b[1] - a[1])
175
+ .forEach(([size, count]) => {
176
+ const varName = FONT_SIZE_MAP[size];
177
+ console.log(` font-size: ${size} => ${varName}: ${count} 次`);
178
+ });
179
+ }
180
+
181
+ if (stats.skippedSizes.size > 0) {
182
+ console.log('\n⚠️ 未映射的字体大小(需要手动检查):');
183
+ Array.from(stats.skippedSizes)
184
+ .sort()
185
+ .forEach(size => {
186
+ console.log(` ${size}`);
187
+ });
188
+ console.log('\n💡 建议:');
189
+ console.log(' 1. 检查这些值是否是特殊尺寸,需要保留');
190
+ console.log(' 2. 如果需要映射,可以将其添加到 FONT_SIZE_MAP 中');
191
+ console.log(' 3. 或考虑调整为最接近的标准尺寸');
192
+ }
193
+
194
+ if (isDryRun) {
195
+ console.log('\n💡 提示: 这是预览模式,文件未被修改');
196
+ console.log(' 移除 --dry-run 参数以实际应用更改');
197
+ } else {
198
+ console.log('\n✨ 转换完成!');
199
+ }
200
+ }
201
+
202
+ // 运行主函数
203
+ if (require.main === module) {
204
+ main();
205
+ }
206
+
207
+ module.exports = { processFileContent };