Skip to content

Commit 8c4a716

Browse files
feat: support for llms.txt and llms-full.txt (#497)
* feat: support for controlled RangePicker * feat: add support for llms.txt and llms-full.txt * chore: fix doc usage, examples and redundant tags
1 parent 7a75740 commit 8c4a716

File tree

64 files changed

+922
-580
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

64 files changed

+922
-580
lines changed

apps/www/next.config.mjs

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { createMDX } from "fumadocs-mdx/next";
1+
import { createMDX } from 'fumadocs-mdx/next';
22

33
const withMDX = createMDX();
44

@@ -10,16 +10,28 @@ const config = {
1010
// Dangerously allow production builds to successfully complete even if
1111
// your project has type errors.
1212
// !! WARN !!
13-
ignoreBuildErrors: true,
13+
ignoreBuildErrors: true
1414
},
1515
eslint: {
1616
// Warning: This allows production builds to successfully complete even if
1717
// your project has ESLint errors.
18-
ignoreDuringBuilds: true,
18+
ignoreDuringBuilds: true
1919
},
2020
experimental: {
21-
optimizePackageImports: ["shiki"],
21+
optimizePackageImports: ['shiki']
2222
},
23+
async rewrites() {
24+
return [
25+
{
26+
source: '/docs/:path*.mdx',
27+
destination: '/llms.mdx/:path*'
28+
},
29+
{
30+
source: '/docs/:path*.md',
31+
destination: '/llms.mdx/:path*'
32+
}
33+
];
34+
}
2335
};
2436

2537
export default withMDX(config);

apps/www/package.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
"fumadocs-core": "^14.7.7",
1717
"fumadocs-docgen": "^1.3.8",
1818
"fumadocs-mdx": "^11.5.6",
19-
"fumadocs-typescript": "^3.1.0",
19+
"fumadocs-typescript": "^4.0.6",
2020
"fumadocs-ui": "^14.7.7",
2121
"lucide-react": "^0.477.0",
2222
"next": "14.2.5",
@@ -25,9 +25,14 @@
2525
"react": "^18.3.1",
2626
"react-dom": "^18.3.1",
2727
"react-live": "^4.1.8",
28+
"remark": "^15.0.1",
29+
"remark-gfm": "^4.0.1",
30+
"remark-mdx": "^3.1.0",
31+
"unist-util-visit": "^5.0.0",
2832
"zod": "^3.24.2"
2933
},
3034
"devDependencies": {
35+
"@types/mdast": "^4.0.4",
3136
"@types/mdx": "^2.0.13",
3237
"@types/node": "22.13.4",
3338
"@types/prettier": "^3.0.0",

apps/www/source.config.ts

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,25 @@
1+
import { TagSchema } from '@/lib/types';
2+
import { remarkInstall } from 'fumadocs-docgen';
13
import {
2-
defineDocs,
34
defineConfig,
4-
frontmatterSchema,
5-
} from "fumadocs-mdx/config";
6-
import { remarkInstall } from "fumadocs-docgen";
7-
import { remarkAutoTypeTable } from "fumadocs-typescript";
8-
import { TagSchema } from "@/lib/types";
5+
defineDocs,
6+
frontmatterSchema
7+
} from 'fumadocs-mdx/config';
8+
import { createGenerator, remarkAutoTypeTable } from 'fumadocs-typescript';
9+
10+
const generator = createGenerator();
911

1012
export const docs = defineDocs({
11-
dir: "src/content/docs",
13+
dir: 'src/content/docs',
1214
docs: {
1315
schema: frontmatterSchema.extend({
14-
tag: TagSchema,
15-
}),
16-
},
16+
tag: TagSchema
17+
})
18+
}
1719
});
1820

1921
export default defineConfig({
2022
mdxOptions: {
21-
remarkPlugins: [remarkInstall, remarkAutoTypeTable],
22-
},
23+
remarkPlugins: [remarkInstall, [remarkAutoTypeTable, { generator }]]
24+
}
2325
});
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import { getLLMText } from '@/lib/ai';
2+
import { docs } from '@/lib/source';
3+
4+
// cached forever
5+
export const revalidate = false;
6+
7+
export async function GET() {
8+
const scan = docs.getPages().map(getLLMText);
9+
const scanned = await Promise.all(scan);
10+
const header =
11+
'<SYSTEM>This is the full developer documentation for Apsara Design System.</SYSTEM>';
12+
13+
return new Response(header + '\n\n' + scanned.join('\n\n***\n\n'));
14+
}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import { getLLMText } from '@/lib/ai';
2+
import { docs } from '@/lib/source';
3+
import { notFound } from 'next/navigation';
4+
import { type NextRequest, NextResponse } from 'next/server';
5+
6+
// cached forever
7+
export const revalidate = false;
8+
9+
export async function GET(
10+
_req: NextRequest,
11+
{ params }: { params: Promise<{ slug?: string[] }> }
12+
) {
13+
const { slug } = await params;
14+
const page = docs.getPage(slug);
15+
16+
if (!page) notFound();
17+
18+
return new NextResponse(await getLLMText(page));
19+
}
20+
21+
export function generateStaticParams() {
22+
return docs.generateParams();
23+
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import { docs } from '@/lib/source';
2+
3+
// cached forever
4+
export const revalidate = false;
5+
6+
export async function GET() {
7+
const scanned: string[] = [];
8+
scanned.push('# Apsara Design System Documentation for LLMs');
9+
const map = new Map<string, string[]>();
10+
11+
for (const page of docs.getPages()) {
12+
const dir = page.slugs[0] ?? 'root';
13+
const list = map.get(dir) ?? [];
14+
list.push(`- [${page.data.title}](${page.url}): ${page.data.description}`);
15+
map.set(dir, list);
16+
}
17+
18+
for (const [key, value] of map) {
19+
scanned.push(`## ${key}`);
20+
scanned.push(value.join('\n'));
21+
}
22+
23+
return new Response(scanned.join('\n\n'));
24+
}

apps/www/src/content/docs/components/amount/index.mdx

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,7 @@ import {
2222
## Usage
2323

2424
```tsx
25-
import { Amount } from '@raystack/apsara/v1'
26-
27-
<Amount value={1299} />
28-
<Amount value={1299} currency="EUR" locale="fr-FR" />
29-
<Amount value="999999999999999" />
25+
import { Amount } from '@raystack/apsara'
3026
```
3127

3228
## Amount Props
@@ -71,4 +67,4 @@ For numbers larger than JavaScript's safe integer limit (2^53 - 1), pass the val
7167

7268
### With Text
7369

74-
<Demo data={withTextDemo} />
70+
<Demo data={withTextDemo} />
Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,23 @@
1-
"use client";
1+
'use client';
22

3-
import { getPropsString } from "@/lib/utils";
3+
import { getPropsString } from '@/lib/utils';
44

55
export const getCode = (props: any) => {
66
return `<AnnouncementBar${getPropsString(props)}/>`;
77
};
88

99
export const playground = {
10-
type: "playground",
10+
type: 'playground',
1111
controls: {
1212
variant: {
13-
type: "select",
14-
options: ["normal", "error", "gradient"],
15-
defaultValue: "normal",
13+
type: 'select',
14+
options: ['normal', 'error', 'gradient'],
15+
defaultValue: 'normal'
1616
},
17-
text: { type: "text", initialValue: "We have introduced a new feature" },
18-
leadingIcon: { type: "icon", defaultValue: "" },
19-
actionLabel: { type: "text", initialValue: "Read More" },
20-
actionIcon: { type: "icon", defaultValue: "" },
17+
text: { type: 'text', initialValue: 'We have introduced a new feature' },
18+
leadingIcon: { type: 'icon', defaultValue: '' },
19+
actionLabel: { type: 'text', initialValue: 'Read More' },
20+
actionIcon: { type: 'icon', defaultValue: '' }
2121
},
22-
getCode,
22+
getCode
2323
};

apps/www/src/content/docs/components/announcement-bar/index.mdx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,12 @@ import {
1515

1616
<Demo data={playground} />
1717

18+
## Usage
19+
20+
```tsx
21+
import { AnnouncementBar } from '@raystack/apsara'
22+
```
23+
1824
## Announcement Bar Props
1925

2026
<auto-type-table path="./props.ts" name="AnnouncementBarProps" />

apps/www/src/content/docs/components/avatar/index.mdx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,17 @@ import {
1515

1616
<Demo data={playground} />
1717

18+
## Usage
19+
20+
```tsx
21+
import { Avatar, AvatarGroup, getAvatarColor } from '@raystack/apsara'
22+
```
23+
1824
## Avatar Props
1925

2026
<auto-type-table path="./props.ts" name="AvatarProps" />
2127

22-
## Avatar Group Props
28+
## AvatarGroup Props
2329

2430
<auto-type-table path="./props.ts" name="AvatarGroupProps" />
2531

0 commit comments

Comments
 (0)