Files
zeekay add397cc62 rebrand: @lobehub/icons → @hanzoai/icons (Hanzo Icons)
Fork of lobe-icons (MIT) rebranded for Hanzo. Renamed all 6 published packages
(@hanzoai/icons + -static-svg/png/webp/avatar + -rn) and every import across
src/ + docs, repo URLs (lobehub/lobe-icons → hanzoai/icons), and prose
(LobeHub → Hanzo). Fresh Hanzo Icons README dropping the upstream marketing
chrome. Preserved: the MIT LICENSE + original copyright (required by the fork),
the LobeHub brand icon itself (src/LobeHub/ — content, like any other brand),
and external @lobehub/* build/demo deps (ui, lint, docs-kit, assets-logo,
fluent-emoji-3d) that have no @hanzoai equivalent. CHANGELOG left as historical.
2026-07-24 01:29:04 -07:00

66 lines
2.3 KiB
TypeScript

import { consola } from 'consola';
import { markdownTable } from 'markdown-table';
import { readFileSync, writeFileSync } from 'node:fs';
import { resolve } from 'node:path';
import { toc } from '@/toc';
import type { IconToc } from '@/types/toc';
const ROOT_PATH = resolve(__dirname, '../..');
const BASE_URL = 'https://lobehub.com/icons/';
const updateReadme = (split: string, md: string, content: string): string => {
const mds = md.split(split);
mds[1] = [' ', content, ' '].join('\n\n');
return mds.join(split);
};
const genMd = (data: IconToc): string =>
[
`<a href="${BASE_URL}${data.id.toLowerCase()}">`,
`<picture>`,
`<source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/hanzoai/icons/refs/heads/master/packages/static-png/dark/${data.param.hasColor ? data.id.toLowerCase() + '-color' : data.id.toLowerCase()}.png" />`,
`<img height="56px" width="56px" src="https://raw.githubusercontent.com/hanzoai/icons/refs/heads/master/packages/static-png/light/${data.param.hasColor ? data.id.toLowerCase() + '-color' : data.id.toLowerCase()}.png" />`,
`</picture>`,
'<br/>',
data.fullTitle,
].join('');
const run = () => {
const model = toc
.filter((item) => item.group === 'model')
.sort((a, b) => a.fullTitle.localeCompare(b.fullTitle));
const provider = toc
.filter((item) => item.group === 'provider')
.sort((a, b) => a.fullTitle.localeCompare(b.fullTitle));
const application = toc
.filter((item) => item.group === 'application')
.sort((a, b) => a.fullTitle.localeCompare(b.fullTitle));
const max = Math.max(model.length, provider.length, application.length);
const table = [
['Model', 'Provider', 'Application'],
...Array.from({ length: max }).map((_, index) => [
model[index] ? genMd(model[index]) : '',
provider[index] ? genMd(provider[index]) : '',
application[index] ? genMd(application[index]) : '',
]),
];
const contents = markdownTable(table);
const readmePath = resolve(ROOT_PATH, 'README.md');
const readme = readFileSync(readmePath, 'utf8');
const newReadme = updateReadme('<!-- ICON LIST -->', readme, contents);
writeFileSync(readmePath, newReadme, 'utf8');
consola.success(`Add ${toc.length} icons to README`);
};
run();