@mintlify/prebuild 1.0.529 → 1.0.531

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,3 +1,4 @@
1
1
  export * from './docsConfigToRss.js';
2
2
  export * from './mdxToRssUpdates.js';
3
3
  export * from './pageToRss.js';
4
+ export * from './pathToRss.js';
@@ -1,3 +1,4 @@
1
1
  export * from './docsConfigToRss.js';
2
2
  export * from './mdxToRssUpdates.js';
3
3
  export * from './pageToRss.js';
4
+ export * from './pathToRss.js';
@@ -1,3 +1,3 @@
1
1
  import { RSSItem } from '@mintlify/common';
2
2
  import { Root } from 'mdast';
3
- export declare const mdxToRssUpdates: (tree: Root) => RSSItem[];
3
+ export declare const mdxToRssUpdates: (tree: Root, existingUpdates: RSSItem[]) => RSSItem[];
@@ -1,6 +1,6 @@
1
1
  import { getTags, isUpdate } from '@mintlify/common';
2
- export const mdxToRssUpdates = (tree) => {
3
- const updates = [];
2
+ export const mdxToRssUpdates = (tree, existingUpdates) => {
3
+ let updates = [];
4
4
  const updateComponents = tree.children.filter((child) => isUpdate(child));
5
5
  for (const updateComponent of updateComponents) {
6
6
  const attributes = updateComponent.attributes;
@@ -10,13 +10,21 @@ export const mdxToRssUpdates = (tree) => {
10
10
  const validTitle = label?.toString() || undefined;
11
11
  const validDescription = description?.toString() || '';
12
12
  const validTags = tags.length > 0 ? tags : undefined;
13
- if (validTitle) {
13
+ const existingUpdate = existingUpdates.find((update) => update.title === validTitle);
14
+ if (existingUpdate && existingUpdate.date) {
15
+ updates.push(existingUpdate);
16
+ }
17
+ else if (validTitle) {
14
18
  updates.push({
15
19
  title: validTitle,
16
20
  description: validDescription,
17
21
  categories: validTags,
22
+ date: new Date().toISOString(),
18
23
  });
19
24
  }
20
25
  }
26
+ if (updates.length > 15) {
27
+ updates = updates.slice(0, 15);
28
+ }
21
29
  return updates;
22
30
  };
@@ -0,0 +1 @@
1
+ export declare const pathToRss: (path: string) => string;
@@ -0,0 +1,3 @@
1
+ export const pathToRss = (path) => {
2
+ return path.replace('src/_props/', '').replace('.mdx', '/rss.xml');
3
+ };
@@ -2,14 +2,15 @@ import fse from 'fs-extra';
2
2
  import { docsConfigToRss } from '../rss/docsConfigToRss.js';
3
3
  import { mdxToRssUpdates } from '../rss/mdxToRssUpdates.js';
4
4
  import { pageToRss } from '../rss/pageToRss.js';
5
+ import { pathToRss } from '../rss/pathToRss.js';
5
6
  export const writeRssFiles = async (docsConfig, rssPages) => {
6
7
  const { orgName, orgDescription } = docsConfigToRss(docsConfig);
7
8
  const rssTargetPath = 'src/_props/rssFiles.json';
8
9
  const rssItemsToSave = rssPages.map((page) => {
9
10
  const { targetPath, tree } = page;
10
11
  const { title, description } = pageToRss(tree);
11
- const rssPath = targetPath.replace('.mdx', '/rss');
12
- const updates = mdxToRssUpdates(tree);
12
+ const rssPath = pathToRss(targetPath);
13
+ const updates = mdxToRssUpdates(tree, []);
13
14
  return {
14
15
  rssPath,
15
16
  orgName,