1
0
mirror of https://github.com/konpa/devicon.git synced 2025-08-12 01:24:42 +02:00

Optimize bot is now a part of the build script (#624)

Co-authored-by: Clemens Bastian <8781699+amacado@users.noreply.github.com>
This commit is contained in:
Thomas Bui
2021-05-27 07:24:59 -07:00
committed by GitHub
parent 1e01930573
commit 48ebd6a93c
2 changed files with 18 additions and 25 deletions

View File

@@ -1,6 +1,8 @@
from pathlib import Path
import sys
from selenium.common.exceptions import TimeoutException
import subprocess
import json
# pycharm complains that build_assets is an unresolved ref
# don't worry about it, the script still runs
@@ -20,11 +22,22 @@ def main():
runner = None
try:
svgs = filehandler.get_svgs_paths(new_icons, args.icons_folder_path, icon_versions_only=False)
# optimizes the files
# do in each batch in case the command
# line complains there's too many characters
start = 0
step = 10
for i in range(start, len(svgs), step):
batch = svgs[i:i + step]
subprocess.run(["npm", "run", "optimize-svg", "--", f"--svgFiles={json.dumps(batch)}"], shell=True)
icon_svgs = filehandler.get_svgs_paths(
new_icons, args.icons_folder_path, icon_versions_only=True)
runner = SeleniumRunner(args.download_path,
args.geckodriver_path, args.headless)
runner.upload_icomoon(args.icomoon_json_path)
svgs = filehandler.get_svgs_paths(new_icons, args.icons_folder_path, True)
runner.upload_svgs(svgs)
runner.upload_svgs(icon_svgs)
zip_name = "devicon-v1.0.zip"
zip_path = Path(args.download_path, zip_name)