UNPKG

@reliverse/rse-sdk

Version:

@reliverse/rse-sdk allows you to create new plugins for @reliverse/rse CLI, interact with reliverse.org, and even extend your own CLI functionality (you may also try @reliverse/dler-sdk for this case).

44 lines (43 loc) 1.52 kB
import { re } from "@reliverse/relico"; import { outro, spinner, log } from "@reliverse/rempts"; export const SPONSORS_JSON_URL = "https://sponsors.amanv.dev/sponsors.json"; export async function fetchSponsors(url = SPONSORS_JSON_URL) { const s = spinner(); s.start("Fetching sponsors\u2026"); const response = await fetch(url); if (!response.ok) { s.stop(re.red(`Failed to fetch sponsors: ${response.statusText}`)); throw new Error(`Failed to fetch sponsors: ${response.statusText}`); } const sponsors = await response.json(); s.stop("Sponsors fetched successfully!"); return sponsors; } export function displaySponsors(sponsors) { if (sponsors.length === 0) { log.info("No sponsors found. You can be the first one! \u2728"); outro( re.cyan( "Visit https://github.com/sponsors/AmanVarshney01 to become a sponsor." ) ); return; } sponsors.forEach((entry, idx) => { const sponsor = entry.sponsor; const displayName = sponsor.name ?? sponsor.login; const tier = entry.tierName ? ` (${entry.tierName})` : ""; log.step(`${idx + 1}. ${re.green(displayName)}${re.yellow(tier)}`); log.message(` ${re.dim("GitHub:")} https://github.com/${sponsor.login}`); const website = sponsor.websiteUrl ?? sponsor.linkUrl; if (website) { log.message(` ${re.dim("Website:")} ${website}`); } }); log.message(""); outro( re.magenta( "Visit https://github.com/sponsors/AmanVarshney01 to become a sponsor." ) ); }