Insightcn

generateRegistryRssFeed

Generate an RSS feed from your registry.

Generate an RSS 2.0 compliant feed from your registry.

Signature

function generateRegistryRssFeed(
  options: GenerateRssOptions
): Promise<string | null>;

Parameters

OptionTypeDescription
baseUrlstringYour registry base URL
rss.titlestringFeed title
rss.descriptionstringFeed description
rss.endpointstringRSS endpoint path (default: /rss)
rss.limitnumberMaximum number of items in feed
github.ownerstringGitHub repository owner
github.repostringGitHub repository name
github.tokenstringGitHub API token for commit dates

Returns

Promise<string | null> — The RSS feed XML string, or null if no items found.

Example

import { generateRegistryRssFeed } from "@insightcn/sdk";

const rss = await generateRegistryRssFeed({
  baseUrl: "https://your-registry.com",
  rss: {
    title: "My Shadcn Registry",
    description: "Custom components for shadcn/ui",
  },
});

console.log(rss);

With GitHub Integration

const rss = await generateRegistryRssFeed({
  baseUrl: "https://your-registry.com",
  rss: {
    title: "My Shadcn Registry",
    description: "Custom components for shadcn/ui",
    endpoint: "/api/rss",
  },
  github: {
    owner: "your-org",
    repo: "your-registry",
    token: process.env.GITHUB_TOKEN,
  },
});

Feed Structure

The generated feed includes:

<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>My Shadcn Registry</title>
    <link>https://your-registry.com</link>
    <description>Custom components for shadcn/ui</description>
    <atom:link href="https://your-registry.com/rss" rel="self" type="application/rss+xml" />
    <item>
      <title>Button</title>
      <link>https://your-registry.com/r/ui/button.json</link>
      <guid>https://your-registry.com/r/ui/button.json</guid>
      <description>A clickable button</description>
      <pubDate>Mon, 01 Jan 2024 00:00:00 GMT</pubDate>
    </item>
  </channel>
</rss>

On this page