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:
sHa
2025-06-19 17:09:45 +03:00
parent 1db0f1cbe9
commit 374ece5142
11 changed files with 424 additions and 386 deletions

View File

@@ -56,7 +56,7 @@
<path fill="none" stroke="#540" stroke-width="2" d="M336.135 248.863h266.159m-262.188 96.136h258.111" />
<path fill="#FFF" stroke="#000" stroke-width=".805"
d="m436.14 311.056 32.228-13.13-13.13 32.229 14.324-9.548 14.325 9.548-13.131-32.229 32.229 13.13-9.55-14.323 9.55-14.324-32.229 13.13 13.131-32.228-14.325 9.549-14.324-9.549 13.13 32.228-32.228-13.13 9.549 14.324-9.549 14.323z" />
<g id="a" fill="#FFF" stroke="#000">
<g id="bl-a" fill="#FFF" stroke="#000">
<path fill="#EACE24" stroke="none"
d="M256.42 398.03c-.345 39.061-.69 40.443-.69 40.443 17.109 16.765 19.139 22.906 24.195 28.346 6.567-9.507 16.764-5.705 16.764-5.705 2.075-8.986 12.964-16.764 12.964-16.764-15.209-1.209-41.48-8.989-43.554-12.099-6.888-10.332 2.592-41.651 2.592-41.651l-12.271 7.43z" />
<path fill="none" stroke="#806600"
@@ -128,17 +128,17 @@
<path fill="#000" stroke="none"
d="M304.346 270.347s2.054 5.674 3.519 6.162c0 0 1.666.56 2.766-.172 1.001-.668 0-2.075 0-2.075-1.342-1.955-6.285-3.915-6.285-3.915m-8.745 2.846s-.339 6.024.819 7.049c0 0 1.313 1.17 2.611.926 1.184-.221.815-1.908.815-1.908-.47-2.326-4.245-6.067-4.245-6.067m5.988 21.264s-.338 6.024.82 7.05c0 0 1.313 1.167 2.611.926 1.181-.222.814-1.909.814-1.909-.47-2.326-4.245-6.067-4.245-6.067m14.788 6.038-.13.301h-.329a.697.697 0 0 1-.527-.246c-.636-.721-.359-3.964-.116-5.977-.627-.818-2.075-2.852-1.885-3.942a.943.943 0 0 1 .43-.658l.317-.198.28.248c.368.326 3.603 3.232 3.83 4.825.133.922-1.398 4.555-1.87 5.647zm-32.675 17.667c-1.099 0-2.07 3.32-1.346 4.689 0 0 .816 1.555 2.118 1.785 1.185.209 1.434-1.5 1.434-1.5.377-2.343-.002-4.974-2.206-4.974m-6.604 48.563c-.472.821-2.362 1.968-2.735 2.189l-.294.174-.27-.211c-.673-.529-.293-1.921 1.128-4.138.006-.99.106-3.571.945-4.327a.947.947 0 0 1 .745-.253l.372.039.067.367c.089.485.845 4.767.042 6.16zm-15.52 4.521c-.273.477-.762.633-1.26.633-.436 0-.878-.119-1.191-.249l-.116-.068c-.819-.641-.438-2.657-.216-3.561.001-.916.081-3.635.945-4.413a.948.948 0 0 1 .744-.253l.349.037.083.341c.25 1.016 1.454 6.154.662 7.533zm12.832-23.586c-.285.494-.774.637-1.241.637-.569 0-1.107-.211-1.208-.253l-.118-.068c-.839-.658-.42-2.752-.201-3.622.176-.507 1.055-2.805 2.531-2.649l.384.041.058.382c.062.419.592 4.144-.205 5.532zm20.046-17.399s-2.435 5.519-1.714 6.886c0 0 .817 1.558 2.119 1.786 1.185.209 1.433-1.5 1.433-1.5.38-2.342-1.838-7.172-1.838-7.172m-7.096 14.258c-3.62 1.194-4.38 5.486-4.112 7.005 0 0 .3 1.732 1.467 2.351 1.064.565 1.825-.986 1.825-.986 1.08-2.114 3.386-6.414.82-8.37m-19.551-21.318c-2.441 1.646-2.449 3.084-2.465 4.629 0 0-.022 1.756 1.013 2.58.943.747 4.174-.638 4.174-.638 1.448-1.879-2.6-1.928-2.722-6.571m26.152-23.586c-2.441 1.646-2.448 1.371-2.464 4.626 0 0 .832 2.614 1.869 3.436.94.748 1.974-1.614 1.974-1.614 1.449-1.877.699-5.838-1.379-6.448m17.972 13.049c-1.1 0-2.07 3.32-1.347 4.686 0 0 .818 1.556 2.119 1.786 1.185.21 1.434-1.499 1.434-1.499.376-2.343-.003-4.973-2.206-4.973m-7.578 9.409c-1.571 5.08-3.413 6.621-2.691 7.988 0 0 1.794.455 3.096.684 1.185.211 1.432-1.497 1.432-1.497.381-2.344-1.471-1.676-1.837-7.175m-42.775 59.174c-1.1 0-2.07 3.319-1.347 4.686 0 0 .816 1.555 2.119 1.785 1.185.209 1.432-1.499 1.432-1.499.38-2.341-.001-4.972-2.204-4.972" />
</g>
<use xlink:href="#a" transform="matrix(-1 0 0 1 938.5 0)" />
<g id="b" fill="#EACE24" stroke="#806600">
<use xlink:href="#bl-a" transform="matrix(-1 0 0 1 938.5 0)" />
<g id="bl-b" fill="#EACE24" stroke="#806600">
<path
d="M462.575 214.875c.309-2.981.144-8.604-1.376-11.159-.514-.862-1.772-1.869-2.755-1.826-.966.043-2.298.336-2.753 1.216-.417.808-.689 2.541-.59 3.45.137 1.264 1.572 3.854 1.572 3.854s-5.142-1.064-6.884-2.434c-1.721-1.356-3.581-3.925-4.13-6.088-.189-.74-.924-3.139.005-6.017.539-1.67 2.159-3.905 3.415-5.018 3.276-2.909 9.636-2.064 10.939-1.341 1.719.957 3.816 2.991 4.522 4.87.549 1.459 1.689 5.766 1.967 7.305.568 3.137.734 4.323.983 7.506.171 2.185.645 4.146.196 6.29-.241 1.155-.541 3.804-1.196 5.549-.658 1.754-1.67 2.604-2.541 3.379-1.78 1.585-7.473 2.435-7.473 2.435s3.128-4.073 3.933-5.884c.959-2.153 1.924-3.732 2.166-6.087M476.522 214.875c-.308-2.981-.144-8.604 1.376-11.159.514-.862 1.774-1.869 2.755-1.826.966.043 2.296.336 2.753 1.216.419.808.69 2.541.59 3.45-.139 1.264-1.574 3.854-1.574 3.854s5.144-1.064 6.886-2.434c1.721-1.356 3.579-3.925 4.129-6.088.189-.74.924-3.139-.005-6.017-.539-1.67-2.161-3.905-3.414-5.018-3.277-2.909-9.639-2.064-10.94-1.341-1.721.957-3.818 2.991-4.524 4.87-.549 1.459-1.688 5.766-1.967 7.305-.568 3.137-.733 4.323-.983 7.506-.173 2.185-.646 4.146-.197 6.29.243 1.155.544 3.804 1.197 5.549.656 1.754 1.67 2.604 2.541 3.379 1.779 1.585 7.474 2.435 7.474 2.435s-3.129-4.073-3.934-5.884c-.955-2.153-1.919-3.732-2.163-6.087" />
<path
d="M469.513 237.02s4.594-3.887 5.356-8.286c.683-3.958-2.362-8.591-2.594-10.455-.921-7.454 1.034-17.384 1.21-18.195.701-3.224 1.581-4.604 2.051-5.66.339-.76 1.304-2.271 2.269-3.735.554-.841 1.787-2.406 2.416-3.999.666-1.687.71-3.405.721-4.321.016-1.561-.271-2.89-.673-4.161-.381-1.209-1.626-3.186-3.429-4.323-1.944-1.226-3.515-2.211-4.114-2.601-1.975-1.289-3.191-5.528-3.215-5.528s-1.24 4.238-3.215 5.528c-.598.39-2.098 1.375-4.043 2.601-1.802 1.136-3.048 3.114-3.427 4.323-.403 1.271-.689 2.6-.671 4.161.009.916.054 2.634.721 4.321.628 1.592 1.861 3.156 2.416 3.999.966 1.464 1.93 2.975 2.268 3.735.47 1.056 1.351 2.436 2.051 5.66.176.811 2.132 10.741 1.209 18.195-.231 1.864-3.348 6.497-2.664 10.455.762 4.398 5.357 8.286 5.357 8.286" />
<path d="m479.837 213.11-2.213-3.16h-16.145l-2.218 3.16 2.218 3.144h16.146l2.212-3.144z" />
</g>
<use xlink:href="#b" x="-86.94" />
<use xlink:href="#b" x="86.94" />
<g id="c">
<use xlink:href="#bl-b" x="-86.94" />
<use xlink:href="#bl-b" x="86.94" />
<g id="bl-c">
<path fill="#EACE24" stroke="#806600" stroke-miterlimit="10"
d="M445.151 439.394h48.684v11.395h-48.684v-11.395zm-.002-2.479c-.081-10.701-1.586-21.734-6.15-31.13a6.23 6.23 0 0 1 8.016 5.969c0 .854-.169 1.663-.479 2.401a6.233 6.233 0 1 1 2.634 11.882c-.446 0-.882-.05-1.302-.138.467 4.205 2.625 7.391 5.216 7.391 2 0 3.74-1.897 4.647-4.696.905 2.799 2.648 4.696 4.647 4.696 2.785 0 5.069-3.681 5.291-8.356a6.186 6.186 0 0 1-3.533 1.103 6.231 6.231 0 0 1-.048-12.464 6.23 6.23 0 0 1 5.405-9.331 6.231 6.231 0 0 1 5.405 9.331 6.232 6.232 0 0 1-.047 12.464 6.19 6.19 0 0 1-3.534-1.103c.221 4.675 2.506 8.356 5.293 8.356 2 0 3.741-1.897 4.647-4.696.906 2.799 2.646 4.696 4.646 4.696 2.593 0 4.749-3.186 5.218-7.391a6.232 6.232 0 0 1-7.534-6.092 6.232 6.232 0 0 1 8.864-5.652 6.23 6.23 0 0 1 7.538-8.37c-4.565 9.396-6.069 20.429-6.151 31.13h-48.689z" />
<path fill="#806600"
@@ -182,6 +182,6 @@
<circle fill="#CCC" stroke="#9E7800" stroke-width=".5" cx="481.16" cy="447.518" r="1.668" />
<circle fill="#FFF" cx="480.874" cy="447.026" r=".677" />
</g>
<use xlink:href="#c" x="-49.151" y="-55.104" />
<use xlink:href="#c" x="49.151" y="-55.104" />
<use xlink:href="#bl-c" x="-49.151" y="-55.104" />
<use xlink:href="#bl-c" x="49.151" y="-55.104" />
</svg>

Before

Width:  |  Height:  |  Size: 38 KiB

After

Width:  |  Height:  |  Size: 38 KiB