Created
June 28, 2023 08:28
-
-
Save frencojobs/7306ac78115d98fbcaedecf0566e843a to your computer and use it in GitHub Desktop.
Differences between upstream Codicons & VSCode's Codicons
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"removed": [ | |
"codicon-bell-slash", | |
"codicon-bell-slash-dot", | |
"codicon-blank", | |
"codicon-circle", | |
"codicon-circle-large", | |
"codicon-circle-small", | |
"codicon-circle-small-filled", | |
"codicon-comment-draft", | |
"codicon-comment-unresolved", | |
"codicon-copy", | |
"codicon-git-pull-request-go-to-changes", | |
"codicon-git-pull-request-new-changes", | |
"codicon-heart-filled", | |
"codicon-insert", | |
"codicon-layout-panel-off", | |
"codicon-layout-sidebar-left-off", | |
"codicon-layout-sidebar-right-off", | |
"codicon-map", | |
"codicon-map-filled", | |
"codicon-search-fuzzy", | |
"codicon-send", | |
"codicon-sparkle", | |
"codicon-table", | |
"codicon-type-hierarchy", | |
"codicon-variable-group", | |
"codicon-wand" | |
], | |
"added": [ | |
"codicon-alert", | |
"codicon-array", | |
"codicon-bracket", | |
"codicon-circle-large-outline", | |
"codicon-circle-outline", | |
"codicon-clock", | |
"codicon-clone", | |
"codicon-close-dirty", | |
"codicon-comment-add", | |
"codicon-compare-changes", | |
"codicon-console", | |
"codicon-debug-breakpoint", | |
"codicon-debug-breakpoint-conditional-disabled", | |
"codicon-debug-breakpoint-data-disabled", | |
"codicon-debug-breakpoint-disabled", | |
"codicon-debug-breakpoint-function-disabled", | |
"codicon-debug-breakpoint-log-disabled", | |
"codicon-debug-breakpoint-unverified", | |
"codicon-debug-hint", | |
"codicon-debug-stackframe-dot", | |
"codicon-debug-stackframe-focused", | |
"codicon-device-desktop", | |
"codicon-eye-unwatch", | |
"codicon-eye-watch", | |
"codicon-file-add", | |
"codicon-file-directory", | |
"codicon-file-directory-create", | |
"codicon-file-text", | |
"codicon-gather", | |
"codicon-gist-fork", | |
"codicon-gist-new", | |
"codicon-gist-private", | |
"codicon-git-branch", | |
"codicon-git-branch-create", | |
"codicon-git-branch-delete", | |
"codicon-git-fork-private", | |
"codicon-git-pull-request-abandoned", | |
"codicon-issue-closed", | |
"codicon-issue-opened", | |
"codicon-kebab-horizontal", | |
"codicon-keyboard", | |
"codicon-light-bulb", | |
"codicon-log-in", | |
"codicon-log-out", | |
"codicon-logo-github", | |
"codicon-mail-reply", | |
"codicon-mark-github", | |
"codicon-microscope", | |
"codicon-mirror-private", | |
"codicon-mirror-public", | |
"codicon-more", | |
"codicon-organization-filled", | |
"codicon-organization-outline", | |
"codicon-pencil", | |
"codicon-person-filled", | |
"codicon-person-follow", | |
"codicon-person-outline", | |
"codicon-plus", | |
"codicon-primitive-dot", | |
"codicon-remove-close", | |
"codicon-repl", | |
"codicon-repo-create", | |
"codicon-repo-delete", | |
"codicon-repo-sync", | |
"codicon-run", | |
"codicon-search-save", | |
"codicon-selection", | |
"codicon-star", | |
"codicon-star-add", | |
"codicon-star-delete", | |
"codicon-stop", | |
"codicon-symbol-constructor", | |
"codicon-symbol-folder", | |
"codicon-symbol-function", | |
"codicon-symbol-module", | |
"codicon-symbol-null", | |
"codicon-symbol-number", | |
"codicon-symbol-object", | |
"codicon-symbol-package", | |
"codicon-symbol-reference", | |
"codicon-symbol-struct", | |
"codicon-symbol-text", | |
"codicon-symbol-type-parameter", | |
"codicon-symbol-unit", | |
"codicon-symbol-value", | |
"codicon-tag-add", | |
"codicon-tag-remove", | |
"codicon-trashcan", | |
"codicon-type-hierarchy-sub", | |
"codicon-variable", | |
"codicon-wrench", | |
"codicon-wrench-subaction", | |
"codicon-x", | |
"codicon-zap" | |
] | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import * as cheerio from 'cheerio' | |
import diff from 'fast-array-diff' | |
import fs from 'node:fs/promises' | |
const UPSTREAM_CODICONS = | |
'https://microsoft.github.io/vscode-codicons/dist/codicon.html' | |
const VSCODE_LISTING = | |
'https://code.visualstudio.com/api/references/icons-in-labels' | |
const getSelector = async (url) => { | |
const response = await fetch(url) | |
const html = await response.text() | |
const $ = cheerio.load(html) | |
return $ | |
} | |
const getMainstreamListing = async () => { | |
const $ = await getSelector(UPSTREAM_CODICONS) | |
return $('#icons .codicon') | |
.map((_, el) => el.attribs.class.split(' ')[1]) | |
.toArray() | |
} | |
const getVscodeListing = async () => { | |
const $ = await getSelector(VSCODE_LISTING) | |
return $('#codicon-listing > table:nth-child(4) tbody .codicon') | |
.map((_, el) => el.attribs.class.split(' ')[1]) | |
.toArray() | |
} | |
const [upstreamListing, vscodeListing] = await Promise.all([ | |
getMainstreamListing(), | |
getVscodeListing(), | |
]) | |
console.log( | |
`Length difference is ${vscodeListing.length} - ${upstreamListing.length} = ${ | |
vscodeListing.length - upstreamListing.length | |
}`, | |
) | |
const result = diff.diff(upstreamListing.sort(), vscodeListing.sort()) | |
console.log(`Writing the differences out to "diff.json"...`) | |
await fs.writeFile('./diff.json', JSON.stringify(result), 'utf-8') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment