migrate layout icons form unicode to material symbols

migrate keymap to yml
This commit is contained in:
2023-07-07 18:40:38 +02:00
parent 83ebbcf7dd
commit ece5b9a000
20 changed files with 2455 additions and 7280 deletions

View File

@@ -17,6 +17,8 @@ import {openSync} from "fontkit"
import {exec} from "child_process"
import config from "../../icons.config.js"
import {statSync, existsSync} from "fs"
import {readFile} from "fs/promises"
import {glob} from "glob"
async function run(command: string[] | string): Promise<string> {
const fullCommand = Array.isArray(command) ? command.join(" ") : command
@@ -35,7 +37,14 @@ async function run(command: string[] | string): Promise<string> {
})
}
const icons = new Set(config.icons)
const yamlFiles = await glob("src/lib/assets/keymaps/*.yml")
const yamlIcons = await Promise.all(
yamlFiles.map(it =>
readFile(it, "utf8").then(file => [...file.matchAll(/^\s*icon:\s+(\w+)/gm)].map(match => match[1])),
),
).then(it => it.flat())
const icons = new Set([...config.icons, ...yamlIcons])
console.log("Icons used:", [...icons.values()].sort())
const font = openSync(config.inputPath)