Every analytics tool wants a subscription. And your data. I built Twiligent instead. YouTube stats. Instagram stats. One dashboard. Runs locally on your machine.
import { readFileSync, writeFileSync } from 'node:fs';
import { dirname, join } from 'node:path';
import { fileURLToPath } from 'node:url';
// writes src/components/icons.tsx with only the Solar icons the site uses; run `npm run icons --workspace site` after editing the list
// the bold style for things and places, the linear style for small controls, as Activepieces uses them
const ICONS: Record<string, string> = {
// things and places
Book: 'book-2-bold',
UsersGroup: 'users-group-rounded-bold',
Login: 'login-3-bold',
Plug: 'plug-circle-bold',
Chart: 'chart-2-bold',
Plane: 'plain-bold',
Bookmark: 'bookmark-bold',
QuestionCircle: 'question-circle-bold',
Server: 'server-bold',
ServerSquare: 'server-square-bold',
Database: 'database-bold',
Key: 'key-bold',
Letter: 'letter-bold',
Gallery: 'gallery-bold',
Cloud: 'cloud-bold',
CloudUpload: 'cloud-upload-bold',
Checklist: 'checklist-minimalistic-bold',
CodeFile: 'code-file-bold',
Calendar: 'calendar-bold',
CalendarMark: 'calendar-mark-bold',
ShieldCheck: 'shield-check-bold',
ChatDots: 'chat-round-dots-bold',
Widget: 'widget-5-bold',
Layers: 'layers-bold',
Library: 'library-bold',
Videocamera: 'videocamera-record-bold',
RefreshCircle: 'refresh-circle-bold',
LockKeyhole: 'lock-keyhole-bold',
Home: 'home-2-bold',
DocumentText: 'document-text-bold',
Upload: 'upload-minimalistic-bold',
ClockCircle: 'clock-circle-bold',
InfoCircle: 'info-circle-bold',
Lightbulb: 'lightbulb-bold',
DangerTriangle: 'danger-triangle-bold',
ShieldWarning: 'shield-warning-bold',
// small controls
AltArrowDown: 'alt-arrow-down-linear',
AltArrowRight: 'alt-arrow-right-linear',
AltArrowLeft: 'alt-arrow-left-linear',
ArrowRight: 'arrow-right-linear',
HamburgerMenu: 'hamburger-menu-linear',
CloseCircle: 'close-circle-linear',
Close: 'close-linear',
Magnifer: 'magnifer-linear',
Copy: 'copy-linear',
CheckCircle: 'check-circle-linear',
LinkMinimalistic: 'link-minimalistic-linear',
Sun: 'sun-2-linear',
Moon: 'moon-linear',
Pen: 'pen-linear',
DangerTriangleLine: 'danger-triangle-linear',
List: 'list-linear',
Add: 'add-linear',
Hashtag: 'hashtag-linear',
Pause: 'pause-linear',
Play: 'play-linear',
};
interface IconSet {
icons: Record<string, { body: string }>;
aliases?: Record<string, { parent: string }>;
}
const here = dirname(fileURLToPath(import.meta.url));
const setPath = join(here, '..', '..', 'node_modules', '@iconify-json', 'solar', 'icons.json');
const set = JSON.parse(readFileSync(setPath, 'utf8')) as IconSet;
function body(name: string): string {
const icon = set.icons[name] ?? set.icons[set.aliases?.[name]?.parent ?? ''];
if (!icon) throw new Error(`Solar has no icon named ${name}`);
return icon.body;
}
const lines = Object.entries(ICONS).map(
([exportName, solarName]) =>
`export const ${exportName} = /* @__PURE__ */ solar(${JSON.stringify(body(solarName))});`,
);
const file = `// generated by build/genIcons.ts; edit the list there and run \`npm run icons --workspace site\`
// icons from Solar by 480 Design, CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/), credited in THIRD_PARTY_NOTICES.md
import type { SVGProps } from 'react';
export type IconProps = Omit<SVGProps<SVGSVGElement>, 'dangerouslySetInnerHTML' | 'children'>;
export type Icon = (props: IconProps) => React.JSX.Element;
// each icon draws in currentColor at 1em, so it takes its colour and size from the text beside it
function solar(markup: string): Icon {
return function SolarIcon(props: IconProps) {
return <svg viewBox="0 0 24 24" width="1em" height="1em" aria-hidden="true" focusable="false" {...props} dangerouslySetInnerHTML={{ __html: markup }} />;
};
}
${lines.join('\n')}
`;
writeFileSync(join(here, '..', 'src', 'components', 'icons.tsx'), file);
console.log(`wrote ${Object.keys(ICONS).length} icons`);