From f82289304fcb1d134aff80764748e7ec91584334 Mon Sep 17 00:00:00 2001 From: George Adams Date: Tue, 3 Oct 2023 22:02:13 +0100 Subject: [PATCH] update install docs to always suggest latest LTS --- .../InstallTabs/LinuxPanel/index.tsx | 18 +++++-- .../InstallTabs/MacOSPanel/index.tsx | 11 +++- .../InstallTabs/WindowsPanel/index.tsx | 15 ++++-- .../__snapshots__/index.test.tsx.snap | 51 ++++++++++++++----- .../__snapshots__/linux-panel.test.tsx.snap | 12 +++-- .../__snapshots__/macos-panel.test.tsx.snap | 3 +- .../__snapshots__/windows-panel.test.tsx.snap | 12 +++-- .../__snapshots__/asciidoc.test.tsx.snap | 12 +++-- 8 files changed, 103 insertions(+), 31 deletions(-) diff --git a/src/components/InstallTabs/LinuxPanel/index.tsx b/src/components/InstallTabs/LinuxPanel/index.tsx index 8b5e30f49..f5fc31891 100644 --- a/src/components/InstallTabs/LinuxPanel/index.tsx +++ b/src/components/InstallTabs/LinuxPanel/index.tsx @@ -1,30 +1,40 @@ -import { Link } from 'gatsby-plugin-react-i18next'; + import React from 'react'; +import { graphql, useStaticQuery } from 'gatsby'; +import { Link } from 'gatsby-plugin-react-i18next'; import ShellBox from '../../ShellBox'; import '../InstallTabs.scss'; export const PureLinuxPanel = (): JSX.Element => { + const data = useStaticQuery(graphql` + query LatestLTS { + mostRecentLts { + version + } + } + `) + const mostRecentLts = data.mostRecentLts.version; return (
# Install the latest LTS version (Debian or Ubuntu)
$ - apt-get install temurin-17-jdk + apt-get install temurin-{mostRecentLts}-jdk

# Install the latest LTS version (CentOS/RHEL/Fedora)
$ - yum install temurin-17-jdk + yum install temurin-{mostRecentLts}-jdk

# Install the latest LTS version (openSUSE/SLES)
$ - zypper install temurin-17-jdk + zypper install temurin-{mostRecentLts}-jdk
{ + const data = useStaticQuery(graphql` + query LatestLTS { + mostRecentLts { + version + } + } + `) + const mostRecentLts = data.mostRecentLts.version; return (
@@ -22,7 +31,7 @@ export const PureMacOSPanel = (): JSX.Element => { brew install --cask temurin8
$ - brew install --cask temurin11 + brew install --cask temurin{mostRecentLts}


diff --git a/src/components/InstallTabs/WindowsPanel/index.tsx b/src/components/InstallTabs/WindowsPanel/index.tsx index 59dc5e210..432aad2a8 100644 --- a/src/components/InstallTabs/WindowsPanel/index.tsx +++ b/src/components/InstallTabs/WindowsPanel/index.tsx @@ -1,15 +1,24 @@ import React from 'react'; +import { graphql, useStaticQuery } from 'gatsby'; import ShellBox from '../../ShellBox'; import '../InstallTabs.scss'; export const PureWindowsPanel = (): JSX.Element => { + const data = useStaticQuery(graphql` + query LatestLTS { + mostRecentLts { + version + } + } + `) + const mostRecentLts = data.mostRecentLts.version; return (
# Install the latest version
$ - winget install EclipseAdoptium.Temurin.17.JDK + winget install EclipseAdoptium.Temurin.{mostRecentLts}.JDK

@@ -23,14 +32,14 @@ export const PureWindowsPanel = (): JSX.Element => { # Upgrade the Winget package
$ - winget upgrade EclipseAdoptium.Temurin.17.JDK + winget upgrade EclipseAdoptium.Temurin.{mostRecentLts}.JDK

# Uninstall the Winget package
$ - winget uninstall EclipseAdoptium.Temurin.17.JDK + winget uninstall EclipseAdoptium.Temurin.{mostRecentLts}.JDK
renders correctly 1`] = ` > winget install - EclipseAdoptium.Temurin.17.JDK + EclipseAdoptium.Temurin. + 1 + .JDK
@@ -160,7 +162,9 @@ exports[`Tests for InstallTabs component > renders correctly 1`] = ` > winget upgrade - EclipseAdoptium.Temurin.17.JDK + EclipseAdoptium.Temurin. + 1 + .JDK
@@ -189,7 +193,9 @@ exports[`Tests for InstallTabs component > renders correctly 1`] = ` > winget uninstall - EclipseAdoptium.Temurin.17.JDK + EclipseAdoptium.Temurin. + 1 + .JDK
renders correctly for Linux 1`] = ` > apt-get install - temurin-17-jdk + temurin- + 1 + -jdk
@@ -348,7 +356,9 @@ exports[`Tests for InstallTabs component > renders correctly for Linux 1`] = ` > yum install - temurin-17-jdk + temurin- + 1 + -jdk
@@ -377,7 +387,9 @@ exports[`Tests for InstallTabs component > renders correctly for Linux 1`] = ` > zypper install - temurin-17-jdk + temurin- + 1 + -jdk
renders correctly for Unix 1`] = ` > apt-get install - temurin-17-jdk + temurin- + 1 + -jdk
@@ -536,7 +550,9 @@ exports[`Tests for InstallTabs component > renders correctly for Unix 1`] = ` > yum install - temurin-17-jdk + temurin- + 1 + -jdk
@@ -565,7 +581,9 @@ exports[`Tests for InstallTabs component > renders correctly for Unix 1`] = ` > zypper install - temurin-17-jdk + temurin- + 1 + -jdk
renders correctly for macOS 1`] = ` > brew install --cask - temurin11 + temurin + 1
@@ -911,7 +930,9 @@ exports[`Tests for InstallTabs component > renders correctly for other 1`] = ` > winget install - EclipseAdoptium.Temurin.17.JDK + EclipseAdoptium.Temurin. + 1 + .JDK
@@ -969,7 +990,9 @@ exports[`Tests for InstallTabs component > renders correctly for other 1`] = ` > winget upgrade - EclipseAdoptium.Temurin.17.JDK + EclipseAdoptium.Temurin. + 1 + .JDK
@@ -998,7 +1021,9 @@ exports[`Tests for InstallTabs component > renders correctly for other 1`] = ` > winget uninstall - EclipseAdoptium.Temurin.17.JDK + EclipseAdoptium.Temurin. + 1 + .JDK
renders correctly 1`] = ` > apt-get install - temurin-17-jdk + temurin- + 1 + -jdk
@@ -57,7 +59,9 @@ exports[`Tests for LinuxPanel component > renders correctly 1`] = ` > yum install - temurin-17-jdk + temurin- + 1 + -jdk
@@ -86,7 +90,9 @@ exports[`Tests for LinuxPanel component > renders correctly 1`] = ` > zypper install - temurin-17-jdk + temurin- + 1 + -jdk
renders correctly 1`] = ` > brew install --cask - temurin11 + temurin + 1
diff --git a/src/components/InstallTabs/__tests__/__snapshots__/windows-panel.test.tsx.snap b/src/components/InstallTabs/__tests__/__snapshots__/windows-panel.test.tsx.snap index e707182fe..3977a9516 100644 --- a/src/components/InstallTabs/__tests__/__snapshots__/windows-panel.test.tsx.snap +++ b/src/components/InstallTabs/__tests__/__snapshots__/windows-panel.test.tsx.snap @@ -28,7 +28,9 @@ exports[`Tests for WindowsPanel component > renders correctly 1`] = ` > winget install - EclipseAdoptium.Temurin.17.JDK + EclipseAdoptium.Temurin. + 1 + .JDK
@@ -86,7 +88,9 @@ exports[`Tests for WindowsPanel component > renders correctly 1`] = ` > winget upgrade - EclipseAdoptium.Temurin.17.JDK + EclipseAdoptium.Temurin. + 1 + .JDK
@@ -115,7 +119,9 @@ exports[`Tests for WindowsPanel component > renders correctly 1`] = ` > winget uninstall - EclipseAdoptium.Temurin.17.JDK + EclipseAdoptium.Temurin. + 1 + .JDK
renders correctly - installation slug 1`] = ` > winget install - EclipseAdoptium.Temurin.17.JDK + EclipseAdoptium.Temurin. + 1 + .JDK
@@ -184,7 +186,9 @@ exports[`Asciidoc pages > renders correctly - installation slug 1`] = ` > winget upgrade - EclipseAdoptium.Temurin.17.JDK + EclipseAdoptium.Temurin. + 1 + .JDK
@@ -213,7 +217,9 @@ exports[`Asciidoc pages > renders correctly - installation slug 1`] = ` > winget uninstall - EclipseAdoptium.Temurin.17.JDK + EclipseAdoptium.Temurin. + 1 + .JDK