Skip to content

A fully functional Android app built entirely with Kotlin and Jetpack Compose

Replace bash commands with proper svgo cli

Simon Marquis56b9871fae84
diff --git a/generateModuleGraphs.sh b/generateModuleGraphs.sh
index eacf19eed..483ea836f 100755
--- a/generateModuleGraphs.sh
+++ b/generateModuleGraphs.sh
@@ -31,6 +31,14 @@ then
exit 1
fi
+# Check if the svgo command is available
+if ! command -v svgo &> /dev/null
+then
+ echo "The 'svgo' command is not found. This is required to cleanup and compress SVGs."
+ echo "Installation instructions available at https://github.com/svg/svgo."
+ exit 1
+fi
+
# Check for a version of grep which supports Perl regex.
# On MacOS the OS installed grep doesn't support Perl regex so check for the existence of the
# GNU version instead which is prefixed with 'g' to distinguish it from the OS installed version.
@@ -114,11 +122,10 @@ echo "$module_paths" | while read -r module_path; do
-Pmodules.graph.of.module="${module_path}" </dev/null
# Convert to SVG using dot, remove unnecessary comments, and reformat
- dot -Tsvg "/tmp/${file_name}.gv" |
- sed 's/<!--/\x0<!--/g;s/-->/-->\x0/g' | grep -zv '^<!--' | tr -d '\0' |
- xmllint --format - \
- > "docs/images/graphs/${file_name}.svg"
+ dot -Tsvg "/tmp/${file_name}.gv" > "docs/images/graphs/${file_name}.svg"
+ # Compress and cleanup SVG file
+ svgo --multipass --pretty "docs/images/graphs/${file_name}.svg"
# Remove the temporary .gv file
rm "/tmp/${file_name}.gv"
fi
-done
\ No newline at end of file
+done