@@ -11,14 +11,15 @@ import {
1111} from './layout/index.js'
1212import { PathMetadataSchema } from './path-metadata.js'
1313
14- const sdks : Array < 'javascript' > = [ ]
15-
1614type Metadata = Partial < Pick < Blueprint , 'routes' | 'resources' > >
1715
1816type File = ApiEndpointLayoutContext &
1917 ApiRouteLayoutContext &
2018 ApiNamespaceLayoutContext & { layout : string }
2119
20+ const rootPath = 'api'
21+ const indexFile = 'README.md'
22+
2223export const reference = (
2324 files : Metalsmith . Files ,
2425 metalsmith : Metalsmith ,
@@ -43,7 +44,7 @@ export const reference = (
4344
4445 const namespacePaths = getNamespacePaths ( blueprint . routes )
4546 for ( const path of namespacePaths ) {
46- const k = `api ${ path } /README.md `
47+ const k = `${ rootPath } ${ path } /${ indexFile } `
4748 files [ k ] = { contents : Buffer . from ( '\n' ) }
4849 const file = files [ k ] as unknown as File
4950 file . layout = 'api-namespace.hbs'
@@ -64,7 +65,7 @@ export const reference = (
6465 if ( route . isUndocumented ) continue
6566 if ( pathMetadata [ route . path ] ?. title == null ) continue
6667
67- const k = `api ${ route . path } /README.md `
68+ const k = `${ rootPath } ${ route . path } /${ indexFile } `
6869 files [ k ] = { contents : Buffer . from ( '\n' ) }
6970 const file = files [ k ] as unknown as File
7071 file . layout = 'api-route.hbs'
@@ -74,19 +75,11 @@ export const reference = (
7475 if ( endpoint . isUndocumented ) continue
7576 if ( endpoint . title . length === 0 ) continue
7677
77- const k = `api ${ endpoint . path } .md`
78+ const k = `${ rootPath } ${ endpoint . path } .md`
7879 files [ k ] = { contents : Buffer . from ( '\n' ) }
7980 const file = files [ k ] as unknown as File
8081 file . layout = 'api-endpoint.hbs'
8182 setEndpointLayoutContext ( file , endpoint , blueprint . actionAttempts )
82-
83- for ( const sdk of sdks ) {
84- const k = `sdk/${ sdk } ${ endpoint . path } .md`
85- files [ k ] = { contents : Buffer . from ( '\n' ) }
86- const file = files [ k ] as unknown as File
87- file . layout = 'sdk-reference.hbs'
88- setEndpointLayoutContext ( file , endpoint , blueprint . actionAttempts )
89- }
9083 }
9184 }
9285}
0 commit comments