From 85ff9bd33a940025148545be10b0572d502d83b6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Lorber?= Date: Thu, 1 Oct 2020 16:13:11 +0200 Subject: [PATCH] chore(v2): v2 website should make it easy to contribute to upstream docs (#3506) * To incitate to contribute to upstream docs, we could set the upstream docs the main docs so that editUrl will modify upstream docs in priority * add unreleased label instead of next --- website/docusaurus.config.js | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/website/docusaurus.config.js b/website/docusaurus.config.js index 05dc003faf..2a370e02be 100644 --- a/website/docusaurus.config.js +++ b/website/docusaurus.config.js @@ -8,6 +8,23 @@ const path = require('path'); const versions = require('./versions.json'); +// This probably only makes sense for the alpha phase, temporary +function getNextAlphaVersionName() { + const expectedPrefix = '2.0.0-alpha.'; + + const lastReleasedVersion = versions[0]; + if (!lastReleasedVersion.includes(expectedPrefix)) { + throw new Error( + 'this code is only meant to be used during the 2.0 alpha phase.', + ); + } + const alphaBuild = parseInt( + lastReleasedVersion.replace(expectedPrefix, ''), + 10, + ); + return `${expectedPrefix}${alphaBuild + 1}`; +} + const allDocHomesPaths = [ '/docs/', '/docs/next/', @@ -177,18 +194,14 @@ module.exports = { showLastUpdateTime: true, remarkPlugins: [require('./src/plugins/remark-npm2yarn')], disableVersioning: isVersioningDisabled, - lastVersion: isDev || isDeployPreview ? 'current' : undefined, + lastVersion: 'current', onlyIncludeVersions: !isVersioningDisabled && (isDev || isDeployPreview) ? ['current', ...versions.slice(0, 2)] : undefined, versions: { current: { - // path: isDev || isDeployPreview ? '' : 'next', - label: - isDev || isDeployPreview - ? `Next (${isDeployPreview ? 'deploy preview' : 'dev'})` - : 'Next', + label: `${getNextAlphaVersionName()} (unreleased)`, }, }, },