Skip to content

Commit

Permalink
3.3.2
Browse files Browse the repository at this point in the history
  • Loading branch information
slorber committed May 3, 2024
1 parent 3aca997 commit 04d00fe
Show file tree
Hide file tree
Showing 102 changed files with 38 additions and 23 deletions.
33 changes: 28 additions & 5 deletions website/docusaurus.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,37 @@ const ArchivedVersionsDropdownItems = Object.entries(VersionsArchived).splice(

function isPrerelease(version: string) {
return (
version.includes('-') ||
version.includes('alpha') ||
version.includes('beta') ||
version.includes('rc')
);
}

function getLastVersion() {
const firstStableVersion = versions.find((version) => !isPrerelease(version));
return firstStableVersion ?? versions[0];
function getLastStableVersion() {
const lastStableVersion = versions.find((version) => !isPrerelease(version));
if (!lastStableVersion) {
throw new Error('unexpected, no stable Docusaurus version?');
}
return lastStableVersion;
}
const announcedVersion = getAnnouncedVersion();

function getLastStableVersionTuple(): [string, string, string] {
const lastStableVersion = getLastStableVersion();
const parts = lastStableVersion.split('.');
if (parts.length !== 3) {
throw new Error(`Unexpected stable version name: ${lastStableVersion}`);
}
return [parts[0]!, parts[1]!, parts[2]!];
}

// The version announced on the homepage hero and announcement banner
// 3.3.2 => 3.3
// 3.0.5 => 3.0
function getAnnouncedVersion() {
const [major, minor] = getLastStableVersionTuple();
return `${major}.${minor}`;
}

// This probably only makes sense for the alpha/beta/rc phase, temporary
Expand Down Expand Up @@ -228,6 +250,7 @@ export default async function createConfigAsync() {
isDeployPreview,
description:
'An optimized site generator in React. Docusaurus helps you to move fast and write content. Build documentation websites, blogs, marketing pages, and more.',
announcedVersion,
},
staticDirectories: [
'static',
Expand Down Expand Up @@ -511,9 +534,9 @@ export default async function createConfigAsync() {
respectPrefersColorScheme: true,
},
announcementBar: {
id: 'announcementBar-v3.2', // Increment on change
id: `announcementBar-v${announcedVersion}`,
// content: `⭐️ If you like Docusaurus, give it a star on <a target="_blank" rel="noopener noreferrer" href="https://github.com/facebook/docusaurus">GitHub</a> and follow us on <a target="_blank" rel="noopener noreferrer" href="https://twitter.com/docusaurus">Twitter ${TwitterSvg}</a>`,
content: `🎉️ <b><a target="_blank" href="https://docusaurus.io/blog/releases/3.2">Docusaurus v3.2</a> is out!</b> 🥳️`,
content: `🎉️ <b><a target="_blank" href="https://docusaurus.io/blog/releases/${announcedVersion}">Docusaurus v${announcedVersion}</a> is out!</b> 🥳️`,
},
prism: {
additionalLanguages: [
Expand Down
26 changes: 9 additions & 17 deletions website/src/pages/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -203,29 +203,21 @@ function FeaturesContainer() {
}

function TopBanner() {
/* TODO restore Ukraine banner after launch
<Translate
id="homepage.banner"
values={{
link: (
<Link to="https://opensource.facebook.com/support-ukraine">
<Translate id="homepage.banner.link">
Help Provide Humanitarian Aid to Ukraine
</Translate>
</Link>
),
}}>
{'Support Ukraine 🇺🇦 {link}.'}
</Translate>
*/
// TODO We should be able to strongly type customFields
// Refactor to use a CustomFields interface + TS declaration merging
const announcedVersion = useDocusaurusContext().siteConfig.customFields
?.announcedVersion as string;

return (
<div className={styles.topBanner}>
<div className={styles.topBannerTitle}>
{'🎉\xa0'}
<Link to="/blog/releases/3.2" className={styles.topBannerTitleText}>
<Link
to={`/blog/releases/${announcedVersion}`}
className={styles.topBannerTitleText}>
<Translate
id="homepage.banner.launch.newVersion"
values={{newVersion: '3.2'}}>
values={{newVersion: announcedVersion}}>
{'Docusaurus\xa0{newVersion} is\xa0out!️'}
</Translate>
</Link>
Expand Down
2 changes: 1 addition & 1 deletion website/versions.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[
"3.3.1",
"3.3.2",
"3.2.1",
"3.1.1",
"3.0.1",
Expand Down

0 comments on commit 04d00fe

Please sign in to comment.