11from pathlib import Path
22import sys
33from selenium .common .exceptions import TimeoutException
4+ import subprocess
5+ import json
46
57# pycharm complains that build_assets is an unresolved ref
68# don't worry about it, the script still runs
@@ -20,11 +22,22 @@ def main():
2022
2123 runner = None
2224 try :
25+ svgs = filehandler .get_svgs_paths (new_icons , args .icons_folder_path , icon_versions_only = False )
26+ # optimizes the files
27+ # do in each batch in case the command
28+ # line complains there's too many characters
29+ start = 0
30+ step = 10
31+ for i in range (start , len (svgs ), step ):
32+ batch = svgs [i :i + step ]
33+ subprocess .run (["npm" , "run" , "optimize-svg" , "--" , f"--svgFiles={ json .dumps (batch )} " ], shell = True )
34+
35+ icon_svgs = filehandler .get_svgs_paths (
36+ new_icons , args .icons_folder_path , icon_versions_only = True )
2337 runner = SeleniumRunner (args .download_path ,
2438 args .geckodriver_path , args .headless )
2539 runner .upload_icomoon (args .icomoon_json_path )
26- svgs = filehandler .get_svgs_paths (new_icons , args .icons_folder_path , True )
27- runner .upload_svgs (svgs )
40+ runner .upload_svgs (icon_svgs )
2841
2942 zip_name = "devicon-v1.0.zip"
3043 zip_path = Path (args .download_path , zip_name )
0 commit comments