From ad056c6edc9934ebf622cfc5c9b21b44280072a4 Mon Sep 17 00:00:00 2001 From: herr kaste Date: Wed, 24 Jun 2026 12:16:21 +0200 Subject: [PATCH] Remove label icons Remove label icon rendering, styling, generated assets, and build plumbing. The search index no longer includes label icon metadata. --- .gitignore | 1 - Makefile | 7 - _includes/packages/macros.njk | 13 +- eleventy.config.mjs | 1 - eleventy.filters.mjs | 69 ----- label-icons-config.json | 9 - label-icons.json | 143 ---------- labels.njk | 7 - package.json | 3 +- packages/package.njk | 2 +- static/label-icons.svg | 512 ---------------------------------- static/module/card.js | 40 --- static/package-search.js | 3 - static/style/label-icons.css | 47 ---- static/style/search.css | 8 - static/styles.css | 1 - util/build-label-icons.mjs | 188 ------------- vitest.config.js | 2 +- 18 files changed, 6 insertions(+), 1050 deletions(-) delete mode 100644 label-icons-config.json delete mode 100644 label-icons.json delete mode 100644 static/label-icons.svg delete mode 100644 static/style/label-icons.css delete mode 100644 util/build-label-icons.mjs diff --git a/.gitignore b/.gitignore index d8c8f97ee..fb74c2ac3 100644 --- a/.gitignore +++ b/.gitignore @@ -51,7 +51,6 @@ _site/* # Database # ###################### -.AFileIcon/ .package_control_channel/ channel.json logs.json diff --git a/Makefile b/Makefile index b6def6a2f..b50db6bd0 100644 --- a/Makefile +++ b/Makefile @@ -37,10 +37,6 @@ build-emoji: curl -L https://raw.githubusercontent.com/github/gemoji/master/db/emoji.json -o emoji-source.json npm run build:emoji -build-label-icons: - [ -d .AFileIcon ] || git clone --depth 1 https://github.com/SublimeText/AFileIcon.git .AFileIcon - npm run build:label-icons - lint: npx eslint @@ -50,9 +46,6 @@ test: clean: rm -rf _site/* -clean-a-fileicon: - rm -rf .AFileIcon - serve: open http://localhost:8080/ npx @11ty/eleventy --serve --quiet diff --git a/_includes/packages/macros.njk b/_includes/packages/macros.njk index 0a1eba647..1f600e5be 100644 --- a/_includes/packages/macros.njk +++ b/_includes/packages/macros.njk @@ -91,7 +91,7 @@

{% endif %} - {{ labels(pkg, true) }} + {{ labels(pkg) }} {% endmacro %} @@ -102,7 +102,7 @@ {% if pkg.platform_statement %}
{{ pkg.platform_statement }}
{% endif %} - {{ labels(pkg, true) }} + {{ labels(pkg) }} {% endif %} {% endmacro %} @@ -150,7 +150,7 @@ {% endif %} {% endmacro %} -{% macro labels(pkg, with_icons=false) %} +{% macro labels(pkg) %} {% set label_buttons -%} {%- for label in pkg.labels %} {% set q = searchQueryFor('label', label) %} @@ -181,13 +181,6 @@ {% else %} - {% set icon_id = (label | label_icon_id) if with_icons else '' %} - {% if icon_id %} - {% set tint = (label | label_icon_tint) if with_icons else '' %} - - {% endif %} {{ label }} {% endif %} diff --git a/eleventy.config.mjs b/eleventy.config.mjs index 731a27ed0..ebff4ce8f 100644 --- a/eleventy.config.mjs +++ b/eleventy.config.mjs @@ -398,7 +398,6 @@ export default async function (eleventyConfig) { bundleCss(path.join(outputDir, `static_${util.gitHash}`, 'styles.css')) }) - eleventyConfig.ignores.add('.AFileIcon') eleventyConfig.ignores.add('util') eleventyConfig.ignores.add('README.md') eleventyConfig.ignores.add('**/*.test.js') diff --git a/eleventy.filters.mjs b/eleventy.filters.mjs index ec8247587..f88ef676a 100644 --- a/eleventy.filters.mjs +++ b/eleventy.filters.mjs @@ -1,42 +1,12 @@ import * as util from './eleventy.util.mjs' -import fs from 'fs' -import path from 'path' -import { fileURLToPath } from 'url' // Compute prod mode locally so filters remain self-contained const isProd = process.env.NODE_ENV === 'production' || process.env.ELEVENTY_ENV === 'production' -const __filename = fileURLToPath(import.meta.url) -const __dirname = path.dirname(__filename) -const sourcesPath = path.join(__dirname, 'label-icons.json') -const configPath = path.join(__dirname, 'label-icons-config.json') - -let labelIconSourceSet = new Set() -let labelIconAliases = {} -let labelIconTints = {} - const longDateFormatter = new Intl.DateTimeFormat('en-US', { dateStyle: 'long' }) const compactNumberFormatter = new Intl.NumberFormat('en', { notation: 'compact' }) const groupedNumberFormatter = new Intl.NumberFormat('en', { useGrouping: true }) const labelSortCollator = new Intl.Collator('en', { numeric: true, sensitivity: 'base' }) -{ - const rawSources = fs.readFileSync(sourcesPath, 'utf8') - const sourcesData = JSON.parse(rawSources) - if (!sourcesData || typeof sourcesData !== 'object') { - throw new Error(`Unexpected data format in ${sourcesPath}; expected object mapping labels to tints`) - } - const labelIconSources = Object.keys(sourcesData) - labelIconSourceSet = new Set(labelIconSources) - labelIconTints = sourcesData - - const rawConfig = fs.readFileSync(configPath, 'utf8') - const configData = JSON.parse(rawConfig) - if (!configData || typeof configData.aliases !== 'object') { - throw new Error(`Missing or invalid "aliases" object in ${configPath}`) - } - - labelIconAliases = configData.aliases -} // Filters as normal functions // simple to date string for some dates without times @@ -62,14 +32,6 @@ export function compact(count) { return compactNumberFormatter.format(count) } -export function label_icon_aliases_json() { - return JSON.stringify(labelIconAliases) -} - -export function label_icon_tints_json() { - return JSON.stringify(labelIconTints) -} - export function label_normalization_note(changes) { const sortedChanges = changes .map(change => ({ from: String(change.from), to: String(change.to) })) @@ -101,8 +63,6 @@ export function label_normalization_note(changes) { export function search_index_json(packages) { return JSON.stringify({ packages: packages.map(compactSearchPackage), - label_icon_aliases: labelIconAliases, - label_icon_tints: labelIconTints, }) } @@ -187,35 +147,6 @@ function joinAsSentenceList(parts) { return `${parts.slice(0, -1).join(', ')}, and ${parts.at(-1)}` } -function canonicalLabel(label) { - if (typeof label !== 'string') return '' - const normalized = label.trim().toLowerCase() - if (!normalized) return '' - - const alias = labelIconAliases[normalized] - if (alias && labelIconSourceSet.has(alias)) { - return alias - } - - if (labelIconSourceSet.has(normalized)) { - return normalized - } - - return '' -} - -export function label_icon_id(label) { - const canonical = canonicalLabel(label) - if (!canonical) return '' - return `label-icon-${canonical}` -} - -export function label_icon_tint(label) { - const canonical = canonicalLabel(label) - if (!canonical) return '' - return labelIconTints[canonical] ?? '' -} - // number formatting with grouping (e.g. 10,000) export function grouping(count) { return groupedNumberFormatter.format(count) diff --git a/label-icons-config.json b/label-icons-config.json deleted file mode 100644 index 8714418ae..000000000 --- a/label-icons-config.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "_": "Manually maintained set of icons to exclude and an alias map from labels to icon/language ids", - "exclude": ["ai"], - "aliases": { - "javascript": "js", - "ecmascript": "js", - "ecmascript6": "js" - } -} diff --git a/label-icons.json b/label-icons.json deleted file mode 100644 index 1a2a7730c..000000000 --- a/label-icons.json +++ /dev/null @@ -1,143 +0,0 @@ -{ - "angular": "red", - "ansible": "red", - "arduino": "cyan", - "asciidoc": "cyan", - "astro": "graphite", - "audio": "red", - "azure": "sky", - "bazel": "green", - "binary": "graphite", - "blade": "orange", - "bower": "yellow", - "c": "purple", - "c#": "blue", - "c++": "sky", - "cairo": "graphite", - "clojure": "purple", - "cmake": "blue", - "coffeescript": "orange", - "composer": "orange", - "cpp": "sky", - "crystal": "graphite", - "css": "blue", - "csv": "green", - "cuda": "green", - "dart": "cyan", - "delphi": "red", - "diff": "yellow", - "dlang": "red", - "docker": "sky", - "elm": "cyan", - "email": "graphite", - "ember": "green", - "erlang": "red", - "eslint": "purple", - "excel": "green", - "font": "green", - "fortran": "red", - "git": "orange", - "gleam": "pink", - "go": "sky", - "graphql": "pink", - "graphviz": "cyan", - "groovy": "cyan", - "haml": "yellow", - "haskell": "purple", - "html": "orange", - "http": "purple", - "image": "green", - "java": "red", - "jest": "red", - "jq": "orange", - "js": "yellow", - "json": "green", - "jsp": "purple", - "jsx": "blue", - "julia": "purple", - "kdl": "purple", - "kotlin": "blue", - "less": "blue", - "liquid": "green", - "lisp": "red", - "log": "graphite", - "lsl": "cyan", - "lua": "blue", - "markdown": "graphite", - "markup": "purple", - "matlab": "orange", - "maven": "red", - "mdx": "cyan", - "nginx": "green", - "nim": "yellow", - "nodejs": "green", - "note": "green", - "npm": "red", - "nsis": "purple", - "ocaml": "yellow", - "odin": "blue", - "parquet": "sky", - "pawn": "orange", - "pdf": "red", - "perl": "graphite", - "php": "blue", - "postcss": "red", - "powershell": "blue", - "preferences": "yellow", - "prisma": "graphite", - "protobuf": "graphite", - "pug": "yellow", - "puppet": "purple", - "python": "yellow", - "qt": "green", - "r": "blue", - "racket": "red", - "rails": "red", - "react": "sky", - "restructuredtext": "sky", - "ruby": "red", - "rust": "sky", - "sass": "pink", - "scala": "red", - "scheme": "graphite", - "scss": "pink", - "settings": "graphite", - "shell": "green", - "slim": "cyan", - "solidity": "graphite", - "source": "sky", - "sql": "blue", - "stata": "sky", - "stylus": "green", - "svelte": "orange", - "svg": "orange", - "swift": "orange", - "systemverilog": "blue", - "tailwind": "cyan", - "terraform": "purple", - "tex": "blue", - "text": "yellow", - "textile": "pink", - "todo": "green", - "toml": "cyan", - "travis": "orange", - "twig": "green", - "typescript": "sky", - "typst": "cyan", - "unreal": "graphite", - "v": "cyan", - "vala": "sky", - "verilog": "blue", - "vhdl": "blue", - "vim": "green", - "vue": "cyan", - "vyper": "graphite", - "wast": "purple", - "webpack": "blue", - "wgsl": "sky", - "windows": "sky", - "wit": "pink", - "yaml": "yellow", - "yarn": "blue", - "zig": "yellow" -} diff --git a/labels.njk b/labels.njk index 8659dba8f..793d45903 100644 --- a/labels.njk +++ b/labels.njk @@ -52,13 +52,6 @@ page_type: labels {% set q = pack.searchQueryFor('label', item.key) %} - {% set icon_id = item.key | label_icon_id %} - {% if icon_id %} - {% set tint = item.key | label_icon_tint %} - - {% endif %} {{ item.key }} {{ item.count }} diff --git a/package.json b/package.json index 60c8ad33a..ce97eec8b 100644 --- a/package.json +++ b/package.json @@ -7,8 +7,7 @@ "test:build": "eleventy --quiet && http-server _site -o", "test": "vitest run", "test:watch": "vitest --watch", - "build:emoji": "node util/build-emoji-json.mjs", - "build:label-icons": "node util/build-label-icons.mjs" + "build:emoji": "node util/build-emoji-json.mjs" }, "dependencies": { "@11ty/eleventy": "^3.1.6", diff --git a/packages/package.njk b/packages/package.njk index 2125266b3..071f5b6b9 100644 --- a/packages/package.njk +++ b/packages/package.njk @@ -97,7 +97,7 @@ page_type: package {% if (pkg.labels and pkg.labels | length) or (pkg.normalized_labels and pkg.normalized_labels | length) %}
- {{ pack.labels(pkg, true) }} + {{ pack.labels(pkg) }} {% if pkg.normalized_labels and pkg.normalized_labels | length %}