| 34 | }; |
| 35 | |
| 36 | function transformFilename(basename) { |
| 37 | // Remove the _4-3_(Light|Dark)@2x suffix and convert kebab-case to PascalCase |
| 38 | let renamed = basename |
| 39 | .replace(/_4-3_(Light|Dark)@2x/i, '') |
| 40 | .replace(/\.png$/i, '.avif') |
| 41 | .replace(/-([a-z])/gi, (_, v) => v.toUpperCase()) |
| 42 | .replace(/^([a-z])/, (_, v) => v.toUpperCase()) // Capitalize first letter |
| 43 | .replace(/ /g, ''); // Remove spaces |
| 44 | |
| 45 | // Apply custom mappings |
| 46 | if (mappings[renamed]) { |
| 47 | renamed = mappings[renamed]; |
| 48 | } |
| 49 | |
| 50 | return renamed; |
| 51 | } |
| 52 | |
| 53 | async function processImages(sourceDir) { |
| 54 | if (!sourceDir) { |