@@ -18,7 +18,7 @@ module.exports = function () {
1818 const urls = [ ] ;
1919
2020 projects . forEach ( ( p ) => {
21- // add release for each of the projects
21+ // add release index for each of the projects
2222 urls . push ( `/${ p } /release` ) ;
2323
2424 const fullProjectVersions = readdirSync (
@@ -33,6 +33,14 @@ module.exports = function () {
3333
3434 const uniqueProjectVersions = [ ...new Set ( projectVersions ) ] ;
3535
36+ const addUrl = ( p , uniqVersion , suffix ) => {
37+ // If it's the latest release version, also create release URLs
38+ if ( projectVersions [ projectVersions . length - 1 ] === uniqVersion ) {
39+ urls . push ( `/${ p } /release/${ suffix } ` ) ;
40+ }
41+ urls . push ( `/${ p } /${ uniqVersion } /${ suffix } ` ) ;
42+ } ;
43+
3644 const oldVersions = [ '1.13' , '2.18' , '3.28' , '4.4' , '4.8' , '4.12' ] ;
3745
3846 uniqueProjectVersions . forEach ( ( uniqVersion ) => {
@@ -61,9 +69,7 @@ module.exports = function () {
6169 // add classes
6270 revIndex . data . relationships [ entity ] . data . forEach ( ( { id } ) => {
6371 const [ , cleanId ] = id . match ( / ^ .+ - \d + \. \d + \. \d + - ( .* ) / ) ;
64- urls . push (
65- `/${ p } /${ uniqVersion } /${ entity } /${ partialUrlEncode ( cleanId ) } `
66- ) ;
72+ addUrl ( p , uniqVersion , `${ entity } /${ partialUrlEncode ( cleanId ) } ` ) ;
6773
6874 const fileName = revIndex . meta [ singularData [ entity ] ] [ id ] ;
6975 let entityData ;
@@ -84,26 +90,26 @@ module.exports = function () {
8490 }
8591
8692 if ( entityData . data . attributes . methods ?. length ) {
87- urls . push (
88- `/ ${ p } / ${ uniqVersion } / ${ entity } / ${ partialUrlEncode (
89- cleanId
90- ) } /methods`
93+ addUrl (
94+ p ,
95+ uniqVersion ,
96+ ` ${ entity } / ${ partialUrlEncode ( cleanId ) } /methods`
9197 ) ;
9298 }
9399
94100 if ( entityData . data . attributes . properties ?. length ) {
95- urls . push (
96- `/ ${ p } / ${ uniqVersion } / ${ entity } / ${ partialUrlEncode (
97- cleanId
98- ) } /properties`
101+ addUrl (
102+ p ,
103+ uniqVersion ,
104+ ` ${ entity } / ${ partialUrlEncode ( cleanId ) } /properties`
99105 ) ;
100106 }
101107
102108 if ( entityData . data . attributes . events ?. length ) {
103- urls . push (
104- `/ ${ p } / ${ uniqVersion } / ${ entity } / ${ partialUrlEncode (
105- cleanId
106- ) } /events`
109+ addUrl (
110+ p ,
111+ uniqVersion ,
112+ ` ${ entity } / ${ partialUrlEncode ( cleanId ) } /events`
107113 ) ;
108114 }
109115
@@ -114,10 +120,10 @@ module.exports = function () {
114120 const listOfFunctions = staticFunctions [ k ] ;
115121
116122 listOfFunctions . forEach ( ( func ) => {
117- urls . push (
118- `/ ${ p } / ${ uniqVersion } /functions/ ${ encodeURIComponent (
119- func . class
120- ) } /${ func . name } `
123+ addUrl (
124+ p ,
125+ uniqVersion ,
126+ `functions/ ${ encodeURIComponent ( func . class ) } /${ func . name } `
121127 ) ;
122128 } ) ;
123129 } ) ;
0 commit comments