Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release 2.9.0 #485

Merged
merged 51 commits into from
Jan 20, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
0247aed
Create eleventy-original.svg
tylensthilaire Dec 30, 2020
3d84d90
Create eleventy-plain.svg
tylensthilaire Dec 30, 2020
94831ce
Update devicon.json
tylensthilaire Dec 30, 2020
2cb3b1a
Update eleventy-plain.svg
tylensthilaire Dec 30, 2020
6870ab4
Update eleventy-original.svg
tylensthilaire Dec 30, 2020
6c8da9e
Merge pull request #1 from devicons/develop
tylensthilaire Dec 31, 2020
9f4b672
new icon: sqlalchemy (plain, original, original-workmark)
EnisMulic Jan 1, 2021
cab2eeb
Merge remote-tracking branch 'upstream/develop' into ReallyLiri/featu…
EnisMulic Jan 2, 2021
984530b
Merge pull request #413 from tylensthilaire/master
Thomas-Boi Jan 5, 2021
a67adc2
Add font aliase for sqlalchemy
EnisMulic Jan 5, 2021
bf4050c
new icon: microsoftsqlserver (plain, plain-wordmark) (#427)
EnisMulic Jan 5, 2021
42a806e
Merge branch 'develop' into ReallyLiri/feature/icon/sqlalchemy
EnisMulic Jan 5, 2021
930f013
new icon: kubernetes (plain, plain-wordmark) (#424)
EnisMulic Jan 5, 2021
be969cd
new icon: rocksdb (plain) (#423)
EnisMulic Jan 5, 2021
5e4c2d6
new icon: googlecloud (original, original-wordmark, plain, plain-word…
EnisMulic Jan 5, 2021
504e53f
new icon: objectivec (plain) (#425)
EnisMulic Jan 5, 2021
d8c4f93
new icon uwsgi (original, plain)
EnisMulic Jan 1, 2021
95ccd33
Cleanup uwsgi icons
EnisMulic Jan 5, 2021
81c9810
Update devicon.json
EnisMulic Jan 6, 2021
cf1ea64
Add adobe XD line icon
Th1nkK1D Oct 22, 2017
2c43ee8
Add xd-plain and eps file
Th1nkK1D Oct 24, 2017
706492b
Clean up xd svg file
Th1nkK1D Jan 6, 2021
1adb2a5
Update devicon.json
Th1nkK1D Jan 6, 2021
5a45a23
new icon: firebase (plain, plain-wordmark) (#461)
EnisMulic Jan 6, 2021
5c0f823
new icon: flask (original, original-wordmark) (#463)
EnisMulic Jan 6, 2021
ad45c83
Merge pull request #462 from EnisMulic/feature/icon/uwsgi
Thomas-Boi Jan 7, 2021
1fb95b7
Update devicon.json
EnisMulic Jan 7, 2021
bc6846d
Merge pull request #426 from EnisMulic/ReallyLiri/feature/icon/sqlalc…
Thomas-Boi Jan 7, 2021
3fb2945
Fixed an error with devicon.json
Thomas-Boi Jan 7, 2021
1eedcd8
Merge pull request #468 from devicons/TB_bugFix
Thomas-Boi Jan 7, 2021
82bccb1
Added check script for the icons and fix icons with fill or viewBox i…
Thomas-Boi Jan 8, 2021
5fea573
Fix the ref issue of the checkout action and sqlalchemy (#472)
Thomas-Boi Jan 9, 2021
b7ae338
Create a monthly script that checks all svgs
Thomas-Boi Jan 8, 2021
b192292
Python now print traceback
Thomas-Boi Jan 8, 2021
c9b1934
Updated file names in check_svgs_on_pr
Thomas-Boi Jan 8, 2021
7303f17
Remove deprecated and unused svg syntax
Th1nkK1D Jan 9, 2021
6e4473a
Remove deprecated and unused svg syntax
Th1nkK1D Jan 9, 2021
c8f1503
Update svg fill, remove unused class
Th1nkK1D Jan 9, 2021
340e85e
Merge pull request #81 from Th1nkK1D/adobe-xd
Thomas-Boi Jan 9, 2021
2e49bfa
Change comment action to a new action
Thomas-Boi Jan 9, 2021
f07f379
Add guideline about squash merging
amacado Jan 10, 2021
5bcd269
Redo the workflow archs so we can comment on pr
Thomas-Boi Jan 11, 2021
d0d101a
Moved check_svgs_monthly to draft
Thomas-Boi Jan 11, 2021
3d2e655
Added working workflow file
Thomas-Boi Jan 11, 2021
c71c518
Merge pull request #480 from devicons/amacado/feature/squash-merging-…
Thomas-Boi Jan 11, 2021
4ea8446
Changed to file read action
Thomas-Boi Jan 11, 2021
7892b03
Merge pull request #481 from devicons/TB_checkSvg
Thomas-Boi Jan 12, 2021
97e6a51
new icon: appwrite (plain, original, wordmark) (#371)
eldadfux Jan 19, 2021
957d798
bot:build new icons, icomoon.json and devicon.css (#486)
github-actions[bot] Jan 19, 2021
38db4a1
Removed 'default fall back icon' from build_icons.yml
Thomas-Boi Jan 20, 2021
c8c4440
Merge pull request #487 from devicons/TB_removeFallback
Thomas-Boi Jan 20, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions .github/drafts/check_devicon_object.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
from typing import List

# abandoned since it's not too hard to check devicon objects using our eyes
# however, still keep in case we need it in the future

def check_devicon_objects(icons: List[dict]):
"""
Check that the devicon objects added is up to standard.
"""
err_msgs = []
for icon in icons:
if type(icon["name"]) != str:
err_msgs.append("'name' must be a string, not: " + str(icon["name"]))

try:
for tag in icon["tags"]:
if type(tag) != str:
raise TypeError()
except TypeError:
err_msgs.append("'tags' must be an array of strings, not: " + str(icon["tags"]))
break


if type(icon["versions"]["svg"]) != list or len(icon["versions"]["svg"]) == 0:
err_msgs.append("Icon name must be a string")

if type(icon["versions"]["font"]) != list or len(icon["versions"]["svg"]) == 0:
err_msgs.append("Icon name must be a string")

if type(icon["color"]) != str or "#" not in icon["color"]:
err_msgs.append("'color' must be a string in the format '#abcdef'")

if type(icon["aliases"]) != list:
err_msgs.append("'aliases' must be an array of dicts")

if len(err_msgs) > 0:
raise Exception("Error found in devicon.json: \n" + "\n".join(err_msgs))
26 changes: 26 additions & 0 deletions .github/drafts/check_svgs_monthly.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import traceback
import sys

# pycharm complains that build_assets is an unresolved ref
# don't worry about it, the script still runs
from build_assets import filehandler, arg_getters
from build_assets import util


def main():
"""
Check the quality of the svgs of the whole icons folder.
"""
args = arg_getters.get_check_svgs_monthly_args()

try:
devicon_json = filehandler.get_json_file_content(args.devicon_json_path)
svgs = filehandler.get_svgs_paths(devicon_json, args.icons_folder_path)
util.check_svgs(svgs)
print("All SVGs found were good. Task completed.")
except Exception as e:
util.exit_with_err(e)


if __name__ == "__main__":
main()
42 changes: 42 additions & 0 deletions .github/drafts/check_svgs_monthly.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Check SVGs Monthly
on: workflow_dispatch
# schedule:
# - cron: '0 0 1 * *'
jobs:
check_develop:
name: Check the SVGs' quality in the `develop` branch
runs-on: ubuntu-18.04
steps:

- uses: actions/checkout@v2
with:
ref: develop

- uses: actions/setup-python@v2
with:
python-version: 3.8

- name: Install dependencies
run: python -m pip install --upgrade pip

- name: Run the check_svg script
run: >
python ./.github/scripts/check_svgs_monthly.py ./devicon.json ./icons

check_master:
name: Check the SVGs' quality in the `master` branch
runs-on: ubuntu-18.04
steps:

- uses: actions/checkout@v2 # check out default branch, which is master

- uses: actions/setup-python@v2
with:
python-version: 3.8

- name: Install dependencies
run: python -m pip install --upgrade pip

- name: Run the check_svg script
run: >
python ./.github/scripts/check_svgs_monthly.py ./icomoon.json ./devicon.json ./icons
34 changes: 34 additions & 0 deletions .github/scripts/build_assets/arg_getters.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@


def get_selenium_runner_args(peek_mode=False):
"""
Get the commandline arguments for the icomoon_peek.py and
icomoon_build.py.
"""
parser = ArgumentParser(description="Upload svgs to Icomoon to create icon files.")

parser.add_argument("--headless",
Expand Down Expand Up @@ -33,4 +37,34 @@ def get_selenium_runner_args(peek_mode=False):
parser.add_argument("--pr_title",
help="The title of the PR that we are peeking at")

return parser.parse_args()


def get_check_svgs_on_pr_args():
"""
Get the commandline arguments for the check_svgs_on_pr.py.
"""
parser = ArgumentParser(description="Check the SVGs to ensure their attributes are correct. Run whenever a PR is opened")
parser.add_argument("files_added_json_path",
help="The path to the files_added.json created by the gh-action-get-changed-files@2.1.4",
action=PathResolverAction)

parser.add_argument("files_modified_json_path",
help="The path to the files_modified.json created by the gh-action-get-changed-files@2.1.4",
action=PathResolverAction)
return parser.parse_args()


def get_check_svgs_monthly_args():
"""
Get the commandline arguments for the check_svgs_monthly.py.
"""
parser = ArgumentParser(description="Check the SVGs to ensure their attributes are correct. Run monthly.")
parser.add_argument("devicon_json_path",
help="The path to the devicon.json",
action=PathResolverAction)

parser.add_argument("icons_folder_path",
help="The path to the icons folder",
action=PathResolverAction)
return parser.parse_args()
122 changes: 97 additions & 25 deletions .github/scripts/build_assets/filehandler.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,16 @@
import re


def find_new_icons(devicon_json_path: str, icomoon_json_path: str) -> List[dict]:
def find_new_icons(devicon_json_path: str, icomoon_json_path: str):
"""
Find the newly added icons by finding the difference between
the devicon.json and the icomoon.json.
:param devicon_json_path, the path to the devicon.json.
:param icomoon_json_path: a path to the iconmoon.json.
:return: a list of the new icons as JSON objects.
"""
with open(devicon_json_path) as json_file:
devicon_json = json.load(json_file)

with open(icomoon_json_path) as json_file:
icomoon_json = json.load(json_file)
devicon_json = get_json_file_content(devicon_json_path)
icomoon_json = get_json_file_content(icomoon_json_path)

new_icons = []
for icon in devicon_json:
Expand All @@ -28,7 +25,17 @@ def find_new_icons(devicon_json_path: str, icomoon_json_path: str) -> List[dict]
return new_icons


def is_not_in_icomoon_json(icon, icomoon_json) -> bool:
def get_json_file_content(json_path: str):
"""
Get the json content of the json_path.
:param: json_path, the path to the json file.
:return: a dict representing the file content.
"""
with open(json_path) as json_file:
return json.load(json_file)


def is_not_in_icomoon_json(icon, icomoon_json):
"""
Checks whether the icon's name is not in the icomoon_json.
:param icon: the icon object we are searching for.
Expand All @@ -44,12 +51,16 @@ def is_not_in_icomoon_json(icon, icomoon_json) -> bool:
return True


def get_svgs_paths(new_icons: List[dict], icons_folder_path: str) -> List[str]:
def get_svgs_paths(new_icons: List[dict], icons_folder_path: str,
icon_versions_only: bool=False, as_str: bool=True):
"""
Get all the suitable svgs file path listed in the devicon.json.
:param new_icons, a list containing the info on the new icons.
:param icons_folder_path, the path where the function can find the
listed folders.
:param icon_versions_only, whether to only get the svgs that can be
made into an icon.
:param: as_str, whether to add the path as a string or as a Path.
:return: a list of svg file paths that can be uploaded to Icomoon.
"""
file_paths = []
Expand All @@ -59,27 +70,56 @@ def get_svgs_paths(new_icons: List[dict], icons_folder_path: str) -> List[str]:
if not folder_path.is_dir():
raise ValueError(f"Invalid path. This is not a directory: {folder_path}.")

# TODO: remove the try-except when the devicon.json is upgraded
try:
aliases = icon_info["aliases"]
except KeyError:
aliases = [] # create empty list of aliases if not provided in devicon.json
if icon_versions_only:
get_icon_svgs_paths(folder_path, icon_info, file_paths, as_str)
else:
get_all_svgs_paths(folder_path, icon_info, file_paths, as_str)
return file_paths


def get_icon_svgs_paths(folder_path: Path, icon_info: dict,
file_paths: List[str], as_str: bool):
"""
Get only the svg file paths that can be made into an icon from the icon_info.
:param: folder_path, the folder where we can find the icons.
:param: icon_info, an icon object in the devicon.json.
:param: file_paths, an array containing all the file paths found.
:param: as_str, whether to add the path as a string or as a Path.
"""
aliases = icon_info["aliases"]

for font_version in icon_info["versions"]["font"]:
# if it's an alias, we don't want to make it into an icon
if is_alias(font_version, aliases):
print(f"Skipping this font since it's an alias: {icon_info['name']}-{font_version}.svg")
continue

for font_version in icon_info["versions"]["font"]:
# if it's an alias, we don't want to make it into an icon
if is_alias(font_version, aliases):
print(f"Not exist {icon_info['name']}-{font_version}.svg")
continue
file_name = f"{icon_info['name']}-{font_version}.svg"
path = Path(folder_path, file_name)

file_name = f"{icon_info['name']}-{font_version}.svg"
path = Path(folder_path, file_name)
if path.exists():
file_paths.append(str(path) if as_str else path)
else:
raise ValueError(f"This path doesn't exist: {path}")

if path.exists():
file_paths.append(str(path))
else:
raise ValueError(f"This path doesn't exist: {path}")

return file_paths
def get_all_svgs_paths(folder_path: Path, icon_info: dict,
file_paths: List[str], as_str: bool):
"""
Get all the svg file paths of an icon.
:param: folder_path, the folder where we can find the icons.
:param: icon_info, an icon object in the devicon.json.
:param: file_paths, an array containing all the file paths found.
:param: as_str, whether to add the path as a string or as a Path.
"""
for font_version in icon_info["versions"]["svg"]:
file_name = f"{icon_info['name']}-{font_version}.svg"
path = Path(folder_path, file_name)

if path.exists():
file_paths.append(str(path) if as_str else path)
else:
raise ValueError(f"This path doesn't exist: {path}")


def is_alias(font_version: str, aliases: List[dict]):
Expand Down Expand Up @@ -166,3 +206,35 @@ def create_screenshot_folder(dir, screenshot_name: str="screenshots/"):
print(f"{screenshot_folder} already exist. Script will do nothing.")
finally:
return str(screenshot_folder)

def get_added_modified_svgs(files_added_json_path: str,
files_modified_json_path: str):
"""
Get the svgs added and modified from the files_changed_json_path.
:param: files_added_json_path, the path to the files_added.json created by the gh-action-get-changed-files@2.1.4
:param: files_modified_json_path, the path to the files_modified.json created by the gh-action-get-changed-files@2.1.4
:return: a list of the svg file paths that were added/modified in this pr as Path.
"""
files_added = get_json_file_content(files_added_json_path)
files_modified = get_json_file_content(files_modified_json_path)

svgs = []
for file in files_added:
path = Path(file)
if path.suffix.lower() == ".svg":
svgs.append(path)

for file in files_modified:
path = Path(file)
if path.suffix.lower() == ".svg":
svgs.append(path)

return svgs


def write_to_file(path: str, value: any):
"""
Write the value to a JSON file.
"""
with open(path, "w") as file:
file.write(value)
Loading