Skip to content

Commit 9b95efb

Browse files
committed
upgrade to renoun 9.3
1 parent 9dd0be9 commit 9b95efb

File tree

17 files changed

+325
-340
lines changed

17 files changed

+325
-340
lines changed

.github/workflows/repro.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: CI
22

33
on:
44
push:
5-
branches:
5+
branches:
66
- "*"
77
- "!main"
88

@@ -26,5 +26,3 @@ jobs:
2626

2727
- name: build
2828
run: pnpm build
29-
30-

create-test-collections.js

Lines changed: 120 additions & 93 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
11
#!/usr/bin/env node
2-
3-
import { writeFileSync, mkdirSync } from 'fs';
4-
import { join } from 'path';
2+
/* eslint-disable */
3+
import { mkdirSync, writeFileSync } from "fs"
4+
import { join } from "path"
55

66
// 5 new collections to create
77
const newCollections = [
8-
'performance-docs',
9-
'security-guides',
10-
'api-reference',
11-
'tutorials-hub',
12-
'best-practices'
13-
];
8+
"performance-docs",
9+
"security-guides",
10+
"api-reference",
11+
"tutorials-hub",
12+
"best-practices",
13+
]
1414

1515
// Template for generating MDX content
1616
const generateContent = (title, collection, category, index, depth = 0) => {
17-
const indent = ' '.repeat(depth);
18-
17+
const indent = " ".repeat(depth)
18+
1919
return `---
2020
title: "${title}"
2121
description: "Documentation for ${title} in ${collection}"
@@ -35,7 +35,7 @@ Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed do eiusmod tempor i
3535
3636
\`\`\`javascript
3737
// Example for ${title}
38-
function ${title.toLowerCase().replace(/[^a-z0-9]/g, '')}Example() {
38+
function ${title.toLowerCase().replace(/[^a-z0-9]/g, "")}Example() {
3939
const config = {
4040
name: "${title}",
4141
collection: "${collection}",
@@ -48,15 +48,15 @@ function ${title.toLowerCase().replace(/[^a-z0-9]/g, '')}Example() {
4848
}
4949
5050
// Usage
51-
const example = ${title.toLowerCase().replace(/[^a-z0-9]/g, '')}Example();
51+
const example = ${title.toLowerCase().replace(/[^a-z0-9]/g, "")}Example();
5252
console.log(example);
5353
\`\`\`
5454
5555
## Configuration
5656
5757
\`\`\`json
5858
{
59-
"name": "${title.toLowerCase().replace(/\s+/g, '-')}",
59+
"name": "${title.toLowerCase().replace(/\s+/g, "-")}",
6060
"version": "1.0.0",
6161
"collection": "${collection}",
6262
"category": "${category}",
@@ -81,9 +81,9 @@ ${indent}- Feature 5: Error handling and logging
8181
### Basic Usage
8282
8383
\`\`\`typescript
84-
import { ${title.replace(/[^a-zA-Z0-9]/g, '')} } from './${title.toLowerCase().replace(/\s+/g, '-')}';
84+
import { ${title.replace(/[^a-zA-Z0-9]/g, "")} } from './${title.toLowerCase().replace(/\s+/g, "-")}';
8585
86-
const instance = new ${title.replace(/[^a-zA-Z0-9]/g, '')}({
86+
const instance = new ${title.replace(/[^a-zA-Z0-9]/g, "")}({
8787
collection: "${collection}",
8888
category: "${category}"
8989
});
@@ -111,7 +111,7 @@ const options = {
111111
}
112112
};
113113
114-
const instance = new ${title.replace(/[^a-zA-Z0-9]/g, '')}(options);
114+
const instance = new ${title.replace(/[^a-zA-Z0-9]/g, "")}(options);
115115
\`\`\`
116116
117117
## API Reference
@@ -179,7 +179,7 @@ Performs cleanup operations.
179179
## Related Documentation
180180
181181
- [${collection} Overview](../index)
182-
- [${category} Guide](../${category.toLowerCase().replace(/\s+/g, '-')}/index)
182+
- [${category} Guide](../${category.toLowerCase().replace(/\s+/g, "-")}/index)
183183
- [API Reference](../api/index)
184184
- [Examples](../examples/index)
185185
@@ -193,30 +193,38 @@ Performs cleanup operations.
193193
194194
---
195195
196-
*Last updated: ${new Date().toISOString().split('T')[0]}*
196+
*Last updated: ${new Date().toISOString().split("T")[0]}*
197197
*Collection: ${collection}*
198198
*Category: ${category}*
199199
*Page: ${index}/100*
200-
`;
201-
};
200+
`
201+
}
202202

203-
console.log('🚀 Starting generation of 5 new collections with 100 pages each...\n');
203+
console.log(
204+
"🚀 Starting generation of 5 new collections with 100 pages each...\n",
205+
)
204206

205207
// Generate each collection
206208
newCollections.forEach((collection, collectionIndex) => {
207-
console.log(`📁 Creating collection: ${collection}`);
208-
209+
console.log(`📁 Creating collection: ${collection}`)
210+
209211
// Create main collection directory
210-
const collectionDir = join('content', collection);
211-
mkdirSync(collectionDir, { recursive: true });
212-
212+
const collectionDir = join("content", collection)
213+
mkdirSync(collectionDir, { recursive: true })
214+
213215
// Create collection index
214216
const collectionIndexContent = `---
215-
title: "${collection.split('-').map(word => word.charAt(0).toUpperCase() + word.slice(1)).join(' ')}"
217+
title: "${collection
218+
.split("-")
219+
.map((word) => word.charAt(0).toUpperCase() + word.slice(1))
220+
.join(" ")}"
216221
description: "Complete documentation for ${collection}"
217222
---
218223
219-
# ${collection.split('-').map(word => word.charAt(0).toUpperCase() + word.slice(1)).join(' ')}
224+
# ${collection
225+
.split("-")
226+
.map((word) => word.charAt(0).toUpperCase() + word.slice(1))
227+
.join(" ")}
220228
221229
Welcome to the ${collection} documentation. This collection contains comprehensive guides, tutorials, and reference materials.
222230
@@ -242,91 +250,110 @@ This collection is organized into several categories to help you find the inform
242250
## Support
243251
244252
If you need help or have questions, please check the troubleshooting sections in each guide or refer to the FAQ.
245-
`;
246-
247-
writeFileSync(join(collectionDir, 'index.mdx'), collectionIndexContent);
248-
253+
`
254+
255+
writeFileSync(join(collectionDir, "index.mdx"), collectionIndexContent)
256+
249257
// Define categories with different nesting structures
250258
const categories = [
251-
{ name: 'getting-started', pages: 15, maxDepth: 2 },
252-
{ name: 'guides', pages: 25, maxDepth: 3 },
253-
{ name: 'reference', pages: 30, maxDepth: 2 },
254-
{ name: 'examples', pages: 20, maxDepth: 3 },
255-
{ name: 'advanced', pages: 10, maxDepth: 4 }
256-
];
257-
258-
let pageCounter = 1;
259-
260-
categories.forEach(category => {
261-
console.log(` 📂 Creating category: ${category.name} (${category.pages} pages)`);
262-
263-
const categoryDir = join(collectionDir, category.name);
264-
mkdirSync(categoryDir, { recursive: true });
265-
259+
{ name: "getting-started", pages: 15, maxDepth: 2 },
260+
{ name: "guides", pages: 25, maxDepth: 3 },
261+
{ name: "reference", pages: 30, maxDepth: 2 },
262+
{ name: "examples", pages: 20, maxDepth: 3 },
263+
{ name: "advanced", pages: 10, maxDepth: 4 },
264+
]
265+
266+
let pageCounter = 1
267+
268+
categories.forEach((category) => {
269+
console.log(
270+
` 📂 Creating category: ${category.name} (${category.pages} pages)`,
271+
)
272+
273+
const categoryDir = join(collectionDir, category.name)
274+
mkdirSync(categoryDir, { recursive: true })
275+
266276
// Create category index
267277
const categoryIndexContent = generateContent(
268-
`${category.name.split('-').map(word => word.charAt(0).toUpperCase() + word.slice(1)).join(' ')} Overview`,
278+
`${category.name
279+
.split("-")
280+
.map((word) => word.charAt(0).toUpperCase() + word.slice(1))
281+
.join(" ")} Overview`,
269282
collection,
270283
category.name,
271-
0
272-
);
273-
writeFileSync(join(categoryDir, 'index.mdx'), categoryIndexContent);
274-
284+
0,
285+
)
286+
writeFileSync(join(categoryDir, "index.mdx"), categoryIndexContent)
287+
275288
// Generate pages for this category
276-
const pagesPerLevel = Math.ceil(category.pages / category.maxDepth);
277-
289+
const pagesPerLevel = Math.ceil(category.pages / category.maxDepth)
290+
278291
for (let depth = 1; depth <= category.maxDepth; depth++) {
279-
const pagesAtThisDepth = Math.min(pagesPerLevel, category.pages - (depth - 1) * pagesPerLevel);
280-
281-
if (pagesAtThisDepth <= 0) break;
282-
292+
const pagesAtThisDepth = Math.min(
293+
pagesPerLevel,
294+
category.pages - (depth - 1) * pagesPerLevel,
295+
)
296+
297+
if (pagesAtThisDepth <= 0) break
298+
283299
for (let i = 1; i <= pagesAtThisDepth; i++) {
284-
let currentDir = categoryDir;
285-
let pathSegments = [category.name];
286-
300+
let currentDir = categoryDir
301+
let pathSegments = [category.name]
302+
287303
// Create nested structure based on depth
288304
if (depth > 1) {
289-
const subDirName = `level-${depth}`;
290-
pathSegments.push(subDirName);
291-
currentDir = join(currentDir, subDirName);
292-
mkdirSync(currentDir, { recursive: true });
293-
305+
const subDirName = `level-${depth}`
306+
pathSegments.push(subDirName)
307+
currentDir = join(currentDir, subDirName)
308+
mkdirSync(currentDir, { recursive: true })
309+
294310
// Create index for subdirectory if it doesn't exist
295-
const subIndexPath = join(currentDir, 'index.mdx');
311+
const subIndexPath = join(currentDir, "index.mdx")
296312
try {
297313
const subIndexContent = generateContent(
298314
`Level ${depth} Overview`,
299315
collection,
300316
`${category.name}/level-${depth}`,
301317
0,
302-
depth - 1
303-
);
304-
writeFileSync(subIndexPath, subIndexContent);
318+
depth - 1,
319+
)
320+
writeFileSync(subIndexPath, subIndexContent)
305321
} catch (e) {
306322
// Index might already exist, that's ok
307323
}
308324
}
309-
310-
const pageTitle = `${category.name.split('-').map(word => word.charAt(0).toUpperCase() + word.slice(1)).join(' ')} ${depth > 1 ? `L${depth} ` : ''}Page ${i}`;
311-
const fileName = `page-${pageCounter}.mdx`;
312-
const filePath = join(currentDir, fileName);
313-
314-
const content = generateContent(pageTitle, collection, category.name, pageCounter, depth - 1);
315-
writeFileSync(filePath, content);
316-
317-
pageCounter++;
325+
326+
const pageTitle = `${category.name
327+
.split("-")
328+
.map((word) => word.charAt(0).toUpperCase() + word.slice(1))
329+
.join(" ")} ${depth > 1 ? `L${depth} ` : ""}Page ${i}`
330+
const fileName = `page-${pageCounter}.mdx`
331+
const filePath = join(currentDir, fileName)
332+
333+
const content = generateContent(
334+
pageTitle,
335+
collection,
336+
category.name,
337+
pageCounter,
338+
depth - 1,
339+
)
340+
writeFileSync(filePath, content)
341+
342+
pageCounter++
318343
}
319344
}
320-
});
321-
322-
console.log(` ✅ Collection ${collection} completed with ${pageCounter - 1} pages\n`);
323-
});
324-
325-
console.log('🎉 Generation complete!');
326-
console.log(`📊 Summary:`);
327-
console.log(` - Collections created: ${newCollections.length}`);
328-
console.log(` - Total pages generated: ~${newCollections.length * 100}`);
329-
console.log(` - Nesting levels: 2-4 levels deep`);
330-
console.log(`\n📝 Next steps:`);
331-
console.log(` 1. Update src/sources.ts to include the new collections`);
332-
console.log(` 2. Run "pnpm build" to test the build with more pages`);
345+
})
346+
347+
console.log(
348+
` ✅ Collection ${collection} completed with ${pageCounter - 1} pages\n`,
349+
)
350+
})
351+
352+
console.log("🎉 Generation complete!")
353+
console.log(`📊 Summary:`)
354+
console.log(` - Collections created: ${newCollections.length}`)
355+
console.log(` - Total pages generated: ~${newCollections.length * 100}`)
356+
console.log(` - Nesting levels: 2-4 levels deep`)
357+
console.log(`\n📝 Next steps:`)
358+
console.log(` 1. Update src/sources.ts to include the new collections`)
359+
console.log(` 2. Run "pnpm build" to test the build with more pages`)

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
"@radix-ui/react-slot": "1.2.3",
3939
"@radix-ui/react-tabs": "1.1.12",
4040
"@radix-ui/react-tooltip": "^1.2.7",
41-
"@renoun/mdx": "2.1.0",
41+
"@renoun/mdx": "3.1.0",
4242
"@tanstack/react-table": "^8.21.3",
4343
"class-variance-authority": "0.7.1",
4444
"clsx": "2.1.1",
@@ -58,7 +58,7 @@
5858
"remark-mdx-frontmatter": "5.2.0",
5959
"remark-squeeze-paragraphs": "6.0.0",
6060
"remark-strip-badges": "7.0.0",
61-
"renoun": "8.14.0",
61+
"renoun": "9.3.0",
6262
"tailwind-merge": "3.3.1",
6363
"tailwindcss-animate": "1.0.7",
6464
"tm-themes": "1.10.7",

0 commit comments

Comments
 (0)