import * as icons from 'simple-icons'; let structs = ""; let map = ""; for (const [name, icon] of Object.entries(icons)) { const varName = "SI" + icon.slug.charAt(0).toUpperCase() + icon.slug.slice(1); structs += varName + ` = Icon{ Title: "${icon.title}", Slug: "${icon.slug}", Hex: "${icon.hex}", Path: "${icon.path}", } ` map += `"${icon.slug}": ${varName}, ` } let tmpl = `package simpleicons import "fmt" // Icon is a SimpleIcon type Icon struct { Title string Slug string Hex string Path string } // SVG returns a complete SVG for the Icon func (i Icon) SVG() string { return fmt.Sprintf(` + "`" + `%s` + "`" + `, i.Title, i.Path) } var ( ${structs} Icons = map[string]Icon{ ${map} } ) ` const path = "./simpleicons.go"; await Bun.write(path, tmpl);