forked from coder/coder
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcheck_site_icons.sh
More file actions
executable file
·45 lines (38 loc) · 856 Bytes
/
check_site_icons.sh
File metadata and controls
executable file
·45 lines (38 loc) · 856 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#!/usr/bin/env bash
set -euo pipefail
# shellcheck source=scripts/lib.sh
source "$(dirname "${BASH_SOURCE[0]}")/lib.sh"
cdroot
cd site/static/icon
# These exceptions are here for backwards compatibility. All new icons should
# be SVG to minimize the size of our repo and our bundle.
exceptions=(
"aws.png"
"azure.png"
"docker.png"
"do.png"
"gcp.png"
"k8s.png"
"ruby.png"
)
function is_exception() {
local value="$1"
shift
for item; do
[[ "$item" == "$value" ]] && return 0
done
return 1
}
for file in *; do
# Extract filename
filename=$(basename -- "$file")
# Check if the file is in the exception list
if is_exception "$filename" "${exceptions[@]}"; then
continue
fi
# If not an exception, check if it's an svg file
if [[ "$file" != *.svg ]]; then
echo "Found a non-svg file not in exception list: $file"
exit 1
fi
done