diff --git a/website/build.mjs b/website/build.mjs index ae9f3a4d569b..1e85a6c66058 100644 --- a/website/build.mjs +++ b/website/build.mjs @@ -93,7 +93,7 @@ async function buildVersionsMenuList(versions, currentVersion, section) { for (const v of versions) { const activityClass = v.label === currentVersion && !v.default ? ' class="active"' : ''; const defaultBadge = v.default ? ' (default)' : ''; - const versionPath = v.default ? '' : `${ v.label }/`; + const versionPath = v.default ? '' : `${ v.path ?? v.label }/`; versionsMenuHtml += `${ v.label }${ defaultBadge }`; } versionsMenuHtml += ''; @@ -232,8 +232,9 @@ async function buildPlaygrounds(template, versions) { } async function buildPlayground(template, version, versions) { - const bundleScript = ``; - const bundleESModulesScript = ``; + const versionPath = version.path ?? version.label; + const bundleScript = ``; + const bundleESModulesScript = ``; const babelScript = ''; const playgroundContent = await readFileContent(`${ config.srcDir }playground.html`); const versionsMenu = await buildVersionsMenu(versions, version.label, 'playground'); @@ -244,7 +245,7 @@ async function buildPlayground(template, version, versions) { playground = playground.replace('{core-js-bundle-esmodules}', bundleESModulesScript); playground = playground.replace('{babel-script}', babelScript); const playgroundWithVersion = playground.replace('{versions-menu}', versionsMenu); - const playgroundFilePath = path.join(config.resultDir, version.label, 'playground.html'); + const playgroundFilePath = path.join(config.resultDir, versionPath, 'playground.html'); if (version.default) { const defaultVersionsMenu = await buildVersionsMenu(versions, version.label, 'playground'); @@ -264,10 +265,11 @@ async function createDocsIndexes(versions) { for (const version of versions) { if (version.default) continue; - const menuItems = await getDocsMenuItems(version.label); + const versionPath = version.path ?? version.label; + const menuItems = await getDocsMenuItems(versionPath); const firstDocPath = path.join(config.resultDir, - `${ menuItems[0].url }.html`.replace(`{docs-version}${ BRANCH ? '/' : '' }`, version.label)); - const indexFilePath = path.join(config.resultDir, `${ version.label }/docs/`, 'index.html'); + `${ menuItems[0].url }.html`.replace(`{docs-version}${ BRANCH ? '/' : '' }`, versionPath)); + const indexFilePath = path.join(config.resultDir, `${ versionPath }/docs/`, 'index.html'); await copy(firstDocPath, indexFilePath); echo(chalk.green(`File created: ${ indexFilePath }`)); } diff --git a/website/scripts/runner.mjs b/website/scripts/runner.mjs index ec9e0b394165..256a2d844c46 100644 --- a/website/scripts/runner.mjs +++ b/website/scripts/runner.mjs @@ -136,7 +136,7 @@ async function copyDocsToBuilder(version) { console.time(`Copied docs to builder for "${ target }"`); await checkoutVersion(version); const fromDir = `${ BUILD_SRC_DIR }docs/web/docs/`; - const toDir = `${ BUILD_DOCS_DIR }${ version.label }/docs/`; + const toDir = `${ BUILD_DOCS_DIR }${ version.path ?? version.label }/docs/`; await copyDocs(fromDir, toDir); console.timeEnd(`Copied docs to builder for "${ target }"`); } @@ -189,7 +189,7 @@ async function checkoutVersion(version) { async function buildAndCopyCoreJS(version) { const target = version.branch ?? version.tag; - const name = version.label; + const name = version.path ?? version.label; console.log(`Building and copying core-js for ${ target }`); const targetBundlePath = `${ BUNDLES_DIR }/${ target }/`; @@ -333,7 +333,7 @@ try { await buildAndCopyCoreJS(version); } } else { - const version = { branch: targetBranch }; + const version = { branch: targetBranch, label: targetBranch }; await hasDocs(version); await buildAndCopyCoreJS(version); }