@@ -18,7 +18,7 @@ module.exports = function () {
18
18
const urls = [ ] ;
19
19
20
20
projects . forEach ( ( p ) => {
21
- // add release for each of the projects
21
+ // add release index for each of the projects
22
22
urls . push ( `/${ p } /release` ) ;
23
23
24
24
const fullProjectVersions = readdirSync (
@@ -33,6 +33,14 @@ module.exports = function () {
33
33
34
34
const uniqueProjectVersions = [ ...new Set ( projectVersions ) ] ;
35
35
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
+
36
44
const oldVersions = [ '1.13' , '2.18' , '3.28' , '4.4' , '4.8' , '4.12' ] ;
37
45
38
46
uniqueProjectVersions . forEach ( ( uniqVersion ) => {
@@ -61,9 +69,7 @@ module.exports = function () {
61
69
// add classes
62
70
revIndex . data . relationships [ entity ] . data . forEach ( ( { id } ) => {
63
71
const [ , cleanId ] = id . match ( / ^ .+ - \d + \. \d + \. \d + - ( .* ) / ) ;
64
- urls . push (
65
- `/${ p } /${ uniqVersion } /${ entity } /${ partialUrlEncode ( cleanId ) } `
66
- ) ;
72
+ addUrl ( p , uniqVersion , `${ entity } /${ partialUrlEncode ( cleanId ) } ` ) ;
67
73
68
74
const fileName = revIndex . meta [ singularData [ entity ] ] [ id ] ;
69
75
let entityData ;
@@ -84,26 +90,26 @@ module.exports = function () {
84
90
}
85
91
86
92
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`
91
97
) ;
92
98
}
93
99
94
100
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`
99
105
) ;
100
106
}
101
107
102
108
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`
107
113
) ;
108
114
}
109
115
@@ -114,10 +120,10 @@ module.exports = function () {
114
120
const listOfFunctions = staticFunctions [ k ] ;
115
121
116
122
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 } `
121
127
) ;
122
128
} ) ;
123
129
} ) ;
0 commit comments