mirror of
https://github.com/shadoll/sLogos.git
synced 2026-02-04 11:03:24 +00:00
Refactor SVG processing scripts and add new functionality
- Updated `svg-cleanup.js` to improve SVG file processing and validation. - Refactored `update-data.js` to streamline the data update process and integrate new scripts for generating image variants and syncing data files. - Introduced `generate-variants.js` to handle the conversion of SVG files to PNG and JPG formats. - Created `sync-data.js` to synchronize logo data with the filesystem, ensuring accurate representation of available images. - Enhanced error handling and logging throughout the scripts for better debugging and user feedback. - Added support for processing all collections or a specific collection based on command-line arguments or environment variables.
This commit is contained in:
@@ -106,24 +106,24 @@ function processSvgFiles(collectionName) {
|
||||
}
|
||||
|
||||
const imagesDir = path.join(__dirname, '..', 'public', collection.baseDir);
|
||||
|
||||
|
||||
if (!fs.existsSync(imagesDir)) {
|
||||
console.error(`Directory does not exist: ${imagesDir}`);
|
||||
return;
|
||||
}
|
||||
|
||||
console.log(`Processing SVG files in collection: ${collection.label}`);
|
||||
|
||||
|
||||
const files = fs.readdirSync(imagesDir);
|
||||
const svgFiles = files.filter(file => /\.svg$/i.test(file));
|
||||
|
||||
|
||||
console.log(`Found ${svgFiles.length} SVG files`);
|
||||
|
||||
|
||||
for (const file of svgFiles) {
|
||||
const svgPath = path.join(imagesDir, file);
|
||||
validateAndFixSvg(svgPath);
|
||||
}
|
||||
|
||||
|
||||
console.log(`Completed processing SVG files for ${collection.label}`);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user