File tree Expand file tree Collapse file tree 1 file changed +11
-2
lines changed
Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -20,6 +20,14 @@ let docsMenu = '';
2020let isBlog = false ;
2121let isDocs = false ;
2222
23+ async function getDefaultVersionTarget ( versionFile , defaultTarget = null ) {
24+ if ( defaultTarget ) return defaultTarget ;
25+
26+ const versions = await readJson ( versionFile ) ;
27+ const defaultVersion = versions . find ( v => v . default ) ;
28+ return defaultVersion ?. branch ?? defaultVersion ?. tag ;
29+ }
30+
2331async function getAllMdFiles ( dir ) {
2432 const entries = await readdir ( dir , { withFileTypes : true } ) ;
2533 const files = [ ] ;
@@ -285,8 +293,9 @@ async function build() {
285293 await buildBlogMenu ( ) ;
286294 const mdFiles = await getAllMdFiles ( config . docsDir ) ;
287295 const versions = await getVersions ( ) ;
288- const bundleScript = `<script nomodule src="${ config . bundlesPath } /${ DEFAULT_VERSION } /${ config . bundleName } "></script>` ;
289- const bundleESModulesScript = `<script type="module" src="${ config . bundlesPath } /${ DEFAULT_VERSION } /${ config . bundleNameESModules } "></script>` ;
296+ const bundlesPath = `${ config . bundlesPath } /${ await getDefaultVersionTarget ( config . versionsFile , BRANCH ) } ` ;
297+ const bundleScript = `<script nomodule src="${ bundlesPath } /${ config . bundleName } "></script>` ;
298+ const bundleESModulesScript = `<script type="module" src="${ bundlesPath } /${ config . bundleNameESModules } "></script>` ;
290299
291300 let currentVersion = '' ;
292301 let versionsMenu = '' ;
You can’t perform that action at this time.
0 commit comments