@@ -10,7 +10,14 @@ import path from 'path'
1010import matter from 'gray-matter'
1111
1212const CONTENT_DIR = path . join ( process . cwd ( ) , 'src/content' )
13- const VALID_SECTIONS = [ 'help' , 'tips' , 'advanced' , 'agents' , 'walkthroughs' , 'case-studies' ]
13+ const VALID_SECTIONS = [
14+ 'help' ,
15+ 'tips' ,
16+ 'advanced' ,
17+ 'agents' ,
18+ 'walkthroughs' ,
19+ 'case-studies' ,
20+ ]
1421
1522// Get all MDX files recursively
1623function getMdxFiles ( dir : string ) : string [ ] {
@@ -38,7 +45,12 @@ function extractInternalLinks(content: string): string[] {
3845 while ( ( match = linkRegex . exec ( content ) ) !== null ) {
3946 const url = match [ 2 ]
4047 // Only collect internal links (starting with / or relative paths to docs)
41- if ( url . startsWith ( '/docs/' ) || url . startsWith ( '/publishers/' ) || url . startsWith ( '/pricing' ) || url . startsWith ( '/store' ) ) {
48+ if (
49+ url . startsWith ( '/docs/' ) ||
50+ url . startsWith ( '/publishers/' ) ||
51+ url . startsWith ( '/pricing' ) ||
52+ url . startsWith ( '/store' )
53+ ) {
4254 links . push ( url )
4355 }
4456 }
@@ -63,20 +75,20 @@ describe('Documentation Content Integrity', () => {
6375 mdxFiles . map ( ( f ) => {
6476 const relative = path . relative ( CONTENT_DIR , f )
6577 return relative . split ( path . sep ) [ 0 ]
66- } )
78+ } ) ,
6779 )
6880
6981 // At least some expected sections should exist
7082 const hasExpectedSections = VALID_SECTIONS . some ( ( section ) =>
71- categories . has ( section )
83+ categories . has ( section ) ,
7284 )
7385 expect ( hasExpectedSections ) . toBe ( true )
7486 } )
7587 } )
7688
7789 describe ( 'Frontmatter Validation' , ( ) => {
7890 it . each (
79- getMdxFiles ( CONTENT_DIR ) . map ( ( f ) => [ path . relative ( CONTENT_DIR , f ) , f ] )
91+ getMdxFiles ( CONTENT_DIR ) . map ( ( f ) => [ path . relative ( CONTENT_DIR , f ) , f ] ) ,
8092 ) ( '%s has valid frontmatter' , ( relativePath , filePath ) => {
8193 const content = fs . readFileSync ( filePath as string , 'utf-8' )
8294 const { data : frontmatter } = matter ( content )
@@ -120,7 +132,9 @@ describe('Documentation Content Integrity', () => {
120132
121133 // Check for duplicates
122134 if ( slugsByCategory [ category ] . includes ( slug ) ) {
123- throw new Error ( `Duplicate slug "${ slug } " found in category "${ category } "` )
135+ throw new Error (
136+ `Duplicate slug "${ slug } " found in category "${ category } "` ,
137+ )
124138 }
125139
126140 slugsByCategory [ category ] . push ( slug )
@@ -148,7 +162,7 @@ describe('Documentation Content Integrity', () => {
148162 } )
149163
150164 it . each (
151- getMdxFiles ( CONTENT_DIR ) . map ( ( f ) => [ path . relative ( CONTENT_DIR , f ) , f ] )
165+ getMdxFiles ( CONTENT_DIR ) . map ( ( f ) => [ path . relative ( CONTENT_DIR , f ) , f ] ) ,
152166 ) ( '%s has valid internal doc links' , ( relativePath , filePath ) => {
153167 const content = fs . readFileSync ( filePath as string , 'utf-8' )
154168 const links = extractInternalLinks ( content )
@@ -181,7 +195,7 @@ describe('Documentation Content Integrity', () => {
181195
182196 describe ( 'Content Quality' , ( ) => {
183197 it . each (
184- getMdxFiles ( CONTENT_DIR ) . map ( ( f ) => [ path . relative ( CONTENT_DIR , f ) , f ] )
198+ getMdxFiles ( CONTENT_DIR ) . map ( ( f ) => [ path . relative ( CONTENT_DIR , f ) , f ] ) ,
185199 ) ( '%s has non-empty content' , ( relativePath , filePath ) => {
186200 const content = fs . readFileSync ( filePath as string , 'utf-8' )
187201 const { content : mdxContent } = matter ( content )
@@ -191,7 +205,7 @@ describe('Documentation Content Integrity', () => {
191205 } )
192206
193207 it . each (
194- getMdxFiles ( CONTENT_DIR ) . map ( ( f ) => [ path . relative ( CONTENT_DIR , f ) , f ] )
208+ getMdxFiles ( CONTENT_DIR ) . map ( ( f ) => [ path . relative ( CONTENT_DIR , f ) , f ] ) ,
195209 ) ( '%s has a heading' , ( relativePath , filePath ) => {
196210 const content = fs . readFileSync ( filePath as string , 'utf-8' )
197211 const { content : mdxContent } = matter ( content )
0 commit comments