import { GithubStarsProvider } from './github-stars.ts' import { DevToProvider } from './dev-to.ts' import { GdeAdvocuProvider } from './gde-advocu.ts' import { StandardSiteProvider } from './standard-site.ts' import { SifaProvider } from './sifa.ts' export interface SyncItem { title: string description?: string body_markdown?: string text_content?: string canonical_url: string type: 'blog' | 'talk' | 'article' | 'event' | 'hackathon' | 'oss' | 'video' | 'forum' | 'other' date?: string tags?: string[] /** `at://` URI of the Bluesky post announcing this item, if there is one. */ bluesky?: string } export interface SyncOptions { dryRun: boolean } export interface SyncProvider { name: string sync(items: SyncItem[], options: SyncOptions): Promise } function createProviders (): SyncProvider[] { return [ new GithubStarsProvider(), new DevToProvider(), new GdeAdvocuProvider(), new StandardSiteProvider(), new SifaProvider(), ] } export async function syncAll (items: SyncItem[], options: SyncOptions): Promise { await Promise.all(createProviders().map(async provider => { try { await provider.sync(items, options) } catch (error) { console.warn(`[sync:${provider.name}] Failed:`, error instanceof Error ? error.message : error) } })) }