Chore: Emit theme token usage metrics (#72500)

* create rule to find instances of theme variables

* emit theme token usage metrics

* move awking into script

* make sure theme usage is covering ts and tsx files, remove commented lines
This commit is contained in:
Ashley Harrison
2023-07-28 15:08:02 +01:00
committed by GitHub
parent 50bd27b665
commit ae4810f854
5 changed files with 66 additions and 0 deletions

View File

@@ -41,7 +41,15 @@ do
BETTERER_STATS+="\"grafana.ci-code.betterer.${name}\": \"${value}\","
done <<< "$(yarn betterer:stats)"
THEME_TOKEN_USAGE=""
while read -r name value
do
THEME_TOKEN_USAGE+=$'\n '
THEME_TOKEN_USAGE+="\"grafana.ci-code.themeUsage.${name}\": \"${value}\","
done <<< "$(yarn themes:usage | awk '$4 == "@grafana/theme-token-usage" {print $3}' | awk '{!seen[$0]++}END{for (i in seen) print i, seen[i]}')"
echo "Metrics: {
$THEME_TOKEN_USAGE
$BETTERER_STATS
\"grafana.ci-code.strictErrors\": \"${ERROR_COUNT}\",
\"grafana.ci-code.accessibilityErrors\": \"${ACCESSIBILITY_ERRORS}\",