1+ import { Docs } from "../cloudflare" ;
2+
13type FormattedFile = {
24 content : string ;
35 title : string ;
@@ -6,8 +8,14 @@ type FormattedFile = {
68 sections : section [ ] ;
79} ;
810
9- const one : FormattedFile = {
10- content : "test" ,
11+ export type ListItem = {
12+ title : string ;
13+ slug : string ;
14+ file : string ;
15+ sections : section [ ] ;
16+ } ;
17+
18+ const one = < ListItem > {
1119 title : "Introduction" ,
1220 slug : "Introduction" ,
1321 file : "00-introduction.md" ,
@@ -77,8 +85,7 @@ const one: FormattedFile = {
7785 } ,
7886 ] ,
7987} ;
80- const two : FormattedFile = {
81- content : "test2" ,
88+ const two = < ListItem > {
8289 title : "Introduction2" ,
8390 slug : "Introduction_2" ,
8491 file : "00-introduction-2.md" ,
@@ -149,8 +156,7 @@ const two: FormattedFile = {
149156 ] ,
150157} ;
151158
152- export const three : FormattedFile = {
153- content : "test3" ,
159+ export const three = < ListItem > {
154160 title : "Introduction3" ,
155161 slug : "Introduction_3" ,
156162 file : "00-introduction-3.md" ,
@@ -220,16 +226,17 @@ export const three: FormattedFile = {
220226 } ,
221227 ] ,
222228} ;
223- export const base : FormattedFile [ ] = [ one , two , three ] ;
224229
225- type section = { slug : string ; title : string ; sections : section [ ] } ;
230+ export const base : Docs = {
231+ full : [
232+ { ...one , content : "test" } ,
233+ { ...two , content : "test2" } ,
234+ { ...three , content : "test3" } ,
235+ ] ,
236+ list : [ one , two , three ] ,
237+ } ;
226238
227- export interface ListItem {
228- title : string ;
229- slug : string ;
230- file : string ;
231- sections : section [ ] ;
232- }
239+ type section = { slug : string ; title : string ; sections : section [ ] } ;
233240
234241export const list : ListItem [ ] = [
235242 {
@@ -446,42 +453,63 @@ export const list: ListItem[] = [
446453
447454export const cf_full = {
448455 key : "svelte@latest:docs:content" ,
449- value : JSON . stringify ( base ) ,
456+ value : JSON . stringify ( base . full ) ,
450457} ;
451458export const cf_list = {
452459 key : "svelte@latest:docs:list" ,
453460 value : JSON . stringify ( list ) ,
454461} ;
455462
456463export const cf_contents_keyby_slug = [
457- { key : "svelte@latest:docs:Introduction" , value : JSON . stringify ( one ) } ,
458- { key : "svelte@latest:docs:Introduction_2" , value : JSON . stringify ( two ) } ,
459- { key : "svelte@latest:docs:Introduction_3" , value : JSON . stringify ( three ) } ,
464+ {
465+ key : "svelte@latest:docs:Introduction" ,
466+ value : JSON . stringify ( { ...one , content : "test" } ) ,
467+ } ,
468+ {
469+ key : "svelte@latest:docs:Introduction_2" ,
470+ value : JSON . stringify ( { ...two , content : "test2" } ) ,
471+ } ,
472+ {
473+ key : "svelte@latest:docs:Introduction_3" ,
474+ value : JSON . stringify ( { ...three , content : "test3" } ) ,
475+ } ,
460476] ;
461477
462478export const cf_contents_keyby_file = [
463- { key : "svelte@latest:docs:00-introduction.md" , value : JSON . stringify ( one ) } ,
479+ {
480+ key : "svelte@latest:docs:00-introduction.md" ,
481+ value : JSON . stringify ( { ...one , content : "test" } ) ,
482+ } ,
464483 {
465484 key : "svelte@latest:docs:00-introduction-2.md" ,
466- value : JSON . stringify ( two ) ,
485+ value : JSON . stringify ( { ... two , content : "test2" } ) ,
467486 } ,
468487 {
469488 key : "svelte@latest:docs:00-introduction-3.md" ,
470- value : JSON . stringify ( three ) ,
489+ value : JSON . stringify ( { ... three , content : "test3" } ) ,
471490 } ,
472491] ;
473492
474493export const cf_full_next = {
475494 key : "svelte@next:docs:content" ,
476- value : JSON . stringify ( base ) ,
495+ value : JSON . stringify ( base . full ) ,
477496} ;
478497export const cf_list_next = {
479498 key : "svelte@next:docs:list" ,
480499 value : JSON . stringify ( list ) ,
481500} ;
482501
483502export const cf_contents_keyby_slug_next = [
484- { key : "svelte@next:docs:Introduction" , value : JSON . stringify ( one ) } ,
485- { key : "svelte@next:docs:Introduction_2" , value : JSON . stringify ( two ) } ,
486- { key : "svelte@next:docs:Introduction_3" , value : JSON . stringify ( three ) } ,
503+ {
504+ key : "svelte@next:docs:Introduction" ,
505+ value : JSON . stringify ( { ...one , content : "test" } ) ,
506+ } ,
507+ {
508+ key : "svelte@next:docs:Introduction_2" ,
509+ value : JSON . stringify ( { ...two , content : "test2" } ) ,
510+ } ,
511+ {
512+ key : "svelte@next:docs:Introduction_3" ,
513+ value : JSON . stringify ( { ...three , content : "test3" } ) ,
514+ } ,
487515] ;
0 commit comments