File tree Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -20,6 +20,13 @@ 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+ return versions . find ( v => v . default ) ?. branch ?? versions . find ( v => v . default ) ?. tag ;
28+ }
29+
2330async function getAllMdFiles ( dir ) {
2431 const entries = await readdir ( dir , { withFileTypes : true } ) ;
2532 const files = [ ] ;
@@ -285,8 +292,9 @@ async function build() {
285292 await buildBlogMenu ( ) ;
286293 const mdFiles = await getAllMdFiles ( config . docsDir ) ;
287294 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>` ;
295+ const defaultVersionTarget = await getDefaultVersionTarget ( config . versionsFile , BRANCH ) ;
296+ const bundleScript = `<script nomodule src="${ config . bundlesPath } /${ defaultVersionTarget } /${ config . bundleName } "></script>` ;
297+ const bundleESModulesScript = `<script type="module" src="${ config . bundlesPath } /${ defaultVersionTarget } /${ config . bundleNameESModules } "></script>` ;
290298
291299 let currentVersion = '' ;
292300 let versionsMenu = '' ;
You can’t perform that action at this time.
0 commit comments