@@ -29,6 +29,34 @@ const contexts = {
2929 ) ,
3030}
3131
32+ const rawContexts = {
33+ keto : require . context (
34+ "!!raw-loader!../../../docs/self-hosted/oel/keto/changelog" ,
35+ false ,
36+ / \. m d $ / ,
37+ ) ,
38+ kratos : require . context (
39+ "!!raw-loader!../../../docs/self-hosted/oel/kratos/changelog" ,
40+ false ,
41+ / \. m d $ / ,
42+ ) ,
43+ oathkeeper : require . context (
44+ "!!raw-loader!../../../docs/self-hosted/oel/oathkeeper/changelog" ,
45+ false ,
46+ / \. m d $ / ,
47+ ) ,
48+ oauth2 : require . context (
49+ "!!raw-loader!../../../docs/self-hosted/oel/oauth2/changelog" ,
50+ false ,
51+ / \. m d $ / ,
52+ ) ,
53+ polis : require . context (
54+ "!!raw-loader!../../../docs/self-hosted/oel/polis/changelog" ,
55+ false ,
56+ / \. m d $ / ,
57+ ) ,
58+ }
59+
3260function baseFromPath ( p ) {
3361 // "./v1.3.2.md" -> "v1.3.2" ; "./CHANGELOG_2.0.md" -> "CHANGELOG_2.0"
3462 return p . replace ( "./" , "" ) . replace ( / \. m d $ / , "" )
@@ -63,20 +91,35 @@ function compareSemverDesc(a, b) {
6391
6492export default function ListChangelogs ( { dir } ) {
6593 const ctx = contexts [ dir ]
94+ const rawCtx = rawContexts [ dir ]
6695 if ( ! ctx ) return < p > No changelogs for "{ dir } "</ p >
6796
6897 const keys = ctx . keys ( ) . sort ( compareSemverDesc )
6998 const Components = keys . map ( ( k ) => ctx ( k ) . default )
99+ const raws = rawCtx
100+ ? keys . map ( ( k ) => {
101+ const mod = rawCtx ( k )
102+ return typeof mod === "string" ? mod : mod . default
103+ } )
104+ : keys . map ( ( ) => "" )
70105
71106 return (
72107 < >
73108 { Components . map ( ( Comp , i ) => {
74109 const basename = baseFromPath ( keys [ i ] )
75110 const version = extractVersion ( basename )
76- // const id = slugify(version);
111+ const raw = raws [ i ] || ""
112+ const isNoChanges = / n o c h a n g e l o g e n t r i e s f o u n d / i. test ( raw . trim ( ) )
77113 return (
78114 < section key = { keys [ i ] } style = { { marginBottom : "2rem" } } >
79- < Comp />
115+ { isNoChanges ? (
116+ < >
117+ < Heading as = "h2" > { version } </ Heading >
118+ < p > No changes requiring a changelog in the { version } .</ p >
119+ </ >
120+ ) : (
121+ < Comp />
122+ ) }
80123 < hr />
81124 </ section >
82125 )
0 commit comments