@@ -89,12 +89,16 @@ async function buildDocsMenuForVersion(version) {
8989 return menu ;
9090}
9191
92+ function getVersionPath ( version ) {
93+ return version . path ?? version . branch ?? version . tag ;
94+ }
95+
9296async function buildVersionsMenuList ( versions , currentVersion , section ) {
9397 let versionsMenuHtml = '<div class="dropdown-block">' ;
9498 for ( const v of versions ) {
9599 const activityClass = v . label === currentVersion && ! v . default ? ' class="active"' : '' ;
96100 const defaultBadge = v . default ? ' (default)' : '' ;
97- const versionPath = v . default ? '' : `${ v . path ?? v . label } /` ;
101+ const versionPath = v . default ? '' : `${ getVersionPath ( v ) } /` ;
98102 versionsMenuHtml += `<a href="./${ versionPath } ${ section } "${ activityClass } >${ v . label } ${ defaultBadge } </a>` ;
99103 }
100104 versionsMenuHtml += '</div>' ;
@@ -227,7 +231,7 @@ async function buildPlaygrounds(template, versions) {
227231}
228232
229233async function buildPlayground ( template , version , versions ) {
230- const versionPath = version . branch ?? version . tag ;
234+ const versionPath = getVersionPath ( version ) ;
231235 const bundleScript = `<script nomodule src="${ config . bundlesPath } /${ versionPath } /${ config . bundleName } "></script>` ;
232236 const bundleESModulesScript = `<script type="module" src="${ config . bundlesPath } /${ versionPath } /${ config . bundleNameESModules } "></script>` ;
233237 const babelScript = '<script src="./babel.min.js"></script>' ;
@@ -256,11 +260,11 @@ async function buildPlayground(template, version, versions) {
256260}
257261
258262async function createDocsIndexes ( versions ) {
259- if ( BRANCH ) versions = [ { label : '' } ] ;
263+ if ( BRANCH ) versions = [ { path : '' } ] ;
260264
261265 for ( const version of versions ) {
262266 if ( version . default ) continue ;
263- const versionPath = version . path ?? version . label ;
267+ const versionPath = getVersionPath ( version ) ;
264268 const menuItems = await getDocsMenuItems ( versionPath ) ;
265269 const firstDocPath = path . join ( config . resultDir ,
266270 `${ menuItems [ 0 ] . url } .html` . replace ( `{docs-version}${ BRANCH ? '/' : '' } ` , versionPath ) ) ;
0 commit comments