From 668beaf7f2ac3a1c846d4cc142bad8d369d23f22 Mon Sep 17 00:00:00 2001 From: Justin Bennett Date: Thu, 2 Feb 2023 16:42:46 -0500 Subject: [PATCH] Add type export of all icon names --- .prettierignore | 1 + icons/icons.ts | 150 ++++++++++++++++++++++++++++++++++++++++ package.json | 2 +- scripts/export-icons.sh | 9 +++ 4 files changed, 161 insertions(+), 1 deletion(-) create mode 100644 .prettierignore create mode 100644 icons/icons.ts diff --git a/.prettierignore b/.prettierignore new file mode 100644 index 00000000..1b763b1b --- /dev/null +++ b/.prettierignore @@ -0,0 +1 @@ +CHANGELOG.md diff --git a/icons/icons.ts b/icons/icons.ts new file mode 100644 index 00000000..ab3a1853 --- /dev/null +++ b/icons/icons.ts @@ -0,0 +1,150 @@ +export type IconName = + | 'access-16' + | 'access-24' + | 'action-16' + | 'action-24' + | 'add-12' + | 'add-roundel-12' + | 'add-roundel-16' + | 'add-roundel-24' + | 'calendar-16' + | 'calendar-24' + | 'carat-down' + | 'carat-left' + | 'carat-right' + | 'carat-up' + | 'chat-16' + | 'chat-24' + | 'checkmark-12' + | 'clipboard-16' + | 'clipboard-24' + | 'close-12' + | 'close-16' + | 'close-8' + | 'cloud-16' + | 'cloud-24' + | 'compability-16' + | 'compatibility-24' + | 'contrast-16' + | 'contrast-24' + | 'cpu-16' + | 'cpu-24' + | 'cpu-large' + | 'cpu-small' + | 'delete-16' + | 'disabled-12' + | 'disk-large' + | 'disk-small' + | 'dislike-16' + | 'distro-alpine' + | 'distro-arch' + | 'distro-centos' + | 'distro-debian' + | 'distro-fedora' + | 'distro-freebsd' + | 'distro-ubuntu' + | 'distro-windows' + | 'document-16' + | 'document-24' + | 'dots-16' + | 'download-roundel-16' + | 'edit-16' + | 'email-16' + | 'error-12' + | 'error-16' + | 'filter-12' + | 'firewall-16' + | 'firewall-24' + | 'folder-16' + | 'folder-24' + | 'gateway-16' + | 'gateway-24' + | 'health-16' + | 'heart-24' + | 'help-16' + | 'hide-16' + | 'hourglass-16' + | 'hourglass-24' + | 'images-16' + | 'images-24' + | 'info-16' + | 'instances-16' + | 'instances-24' + | 'integration-16' + | 'ip-global-16' + | 'ip-global-24' + | 'ip-local-16' + | 'ip-local-24' + | 'issues-16' + | 'issues-24' + | 'key-12' + | 'key-16' + | 'key-24' + | 'like-16' + | 'link-16' + | 'load-balancer-16' + | 'load-balancer-24' + | 'loader-12' + | 'location-24' + | 'logs-16' + | 'logs-24' + | 'metrics-16' + | 'more-12' + | 'networking-16' + | 'networking-24' + | 'new-window-16' + | 'next-arrow-12' + | 'notifications-16' + | 'open-link-12' + | 'organization-16' + | 'organization-24' + | 'overview-16' + | 'overview-24' + | 'person-16' + | 'person-24' + | 'person-group-16' + | 'person-group-24' + | 'prev-arrow-12' + | 'profile-16' + | 'progress-24' + | 'prohibited-24' + | 'question-12' + | 'racks-24' + | 'ram-large' + | 'ram-small' + | 'refresh-16' + | 'repair-12' + | 'repair-16' + | 'resize-16' + | 'resize-24' + | 'router-16' + | 'router-24' + | 'safety-24' + | 'search-16' + | 'security-12' + | 'security-16' + | 'security-24' + | 'select-arrows-6' + | 'servers-16' + | 'settings-16' + | 'settings-24' + | 'show-16' + | 'snapshots-16' + | 'snapshots-24' + | 'software-update-16' + | 'software-update-24' + | 'speaker-24' + | 'storage-16' + | 'storage-24' + | 'subnet-16' + | 'subnet-24' + | 'success-12' + | 'tags-16' + | 'terminal-16' + | 'terminal-24' + | 'time-16' + | 'transmit-24' + | 'unauthorized-12' + | 'unread-indicator-6' + | 'warning-12' + | 'wireless-24' diff --git a/package.json b/package.json index 43e39bf2..83b61d57 100644 --- a/package.json +++ b/package.json @@ -36,7 +36,7 @@ "files": [ "styles/dist/*.css", "styles/dist/tailwind-tokens.js", - "icons/**.svg" + "icons/**" ], "repository": { "type": "git", diff --git a/scripts/export-icons.sh b/scripts/export-icons.sh index d8d7e3b2..228495b3 100755 --- a/scripts/export-icons.sh +++ b/scripts/export-icons.sh @@ -17,4 +17,13 @@ npx figma-export use-config # Replace fills with current color sed -i 's/fill=".*"/fill="currentColor"/g' icons/* +# Export icons type file +touch icons/icons.ts +echo "export type IconName =" > icons/icons.ts +for icon in icons/*.svg; do + echo "| \"${icon}\"" >> icons/icons.ts +done + +sed -E -i 's|icons/(..*)\.svg|\1|g' icons/icons.ts + npm run fmt .