import {
renderSvg,
embedExternalImages,
createConfiguration,
NormalizedGitHubData,
SavedConfiguration,
WidgetInstance,
} from '@/engine'
// 1. Prepare Mock or Live GitHub Data
const profileData: NormalizedGitHubData = {
user: {
id: 123456,
login: 'octocat',
name: 'The Octocat',
avatar_url: 'https://github.com/images/error/octocat_happy.gif',
bio: 'Building open source developer tools.',
company: 'GitHub',
blog: 'https://github.blog',
location: 'San Francisco, CA',
email: null,
twitter_username: 'github',
public_repos: 8,
public_gists: 1,
followers: 1200,
following: 0,
created_at: '2011-01-25T18:44:36Z',
updated_at: '2026-01-01T00:00:00Z',
},
repos: [
{
id: 1,
name: 'git-ascii',
description: 'Aesthetic SVG generator for developer profiles',
stargazers_count: 340,
forks_count: 24,
language: 'TypeScript',
html_url: 'https://github.com/octocat/git-ascii',
fork: false,
updated_at: '2026-02-18T10:00:00Z',
},
],
languages: {
TypeScript: 84500,
JavaScript: 12400,
CSS: 5600,
},
totalStars: 340,
totalForks: 24,
readmeContent: null,
socialAccounts: [],
contributions: {
totalContributions: 1420,
weeks: [],
},
}
// 2. Generate a Configuration Preset
const config: SavedConfiguration = createConfiguration(
profileData.user.id,
profileData.user.login,
'terminal', // 'terminal' | 'minimal' | 'dracula' | 'synthwave' | etc.
'default',
'Default Profile',
profileData
)
// 3. Render Pure SVG
const rawSvg = renderSvg(config, profileData, { theme: 'dark' })
// 4. Inline External Images (for shields and remote avatars)
const { svg: finalSvg, hasErrors } = await embedExternalImages(rawSvg)
console.log(finalSvg) // Standard XML/SVG string