diff --git a/src/lib/__tests__/is-release-notes-page.test.ts b/src/lib/__tests__/is-release-notes-page.test.ts deleted file mode 100644 index 15c7a57d7f..0000000000 --- a/src/lib/__tests__/is-release-notes-page.test.ts +++ /dev/null @@ -1,60 +0,0 @@ -/** - * Copyright (c) HashiCorp, Inc. - * SPDX-License-Identifier: MPL-2.0 - */ - -import { isReleaseNotesPage } from 'lib/docs/is-release-notes-page' - -describe('isReleaseNotesPage', () => { - it('returns true for valid release notes page paths', () => { - const validPaths = [ - '/releases/2022/v220601-1', - '/releases/2021/v210601-2', - '/release-notes/1.2.3', - '/release-notes/2.0.x', - '/release-notes/v2.0.x', - '/boundary/docs/release-notes/v0_15_0', - '/vault/docs/release-notes/1.13.0', - ] - - validPaths.forEach((path) => { - expect(isReleaseNotesPage(path)).toBe(true) - }) - }) - - it('returns false for invalid release notes page paths', () => { - const invalidPaths = [ - '/releases/2022/v220601', - '/releases/2021/v210601', - '/release-notes/1.2', - '/release-notes/2.0', - '/release-notes/2.x', - '/releases/2022/v220601-', - '/releases/2021/v210601-', - '/release-notes/1.2.', - '/release-notes/2.0.', - '/release-notes/2.x.', - '/releases/2022/v220601-1234-5678', - '/releases/2021/v210601-5678-1234', - '/release-notes/1.2.3.4', - '/release-notes/2.0.x.y', - ] - invalidPaths.forEach((path) => { - expect(isReleaseNotesPage(path)).toBe(false) - }) - }) - - it('returns false for non-release notes page paths', () => { - const nonReleaseNotesPaths = [ - '/releases', - '/getting-started', - '/enterprise/v202401-1/migrate', - '/enterprise/v202401-1/releases', - '/waypoint/reference/config', - '/vault/install', - ] - nonReleaseNotesPaths.forEach((path) => { - expect(isReleaseNotesPage(path)).toBe(false) - }) - }) -}) diff --git a/src/lib/docs/is-release-notes-page.ts b/src/lib/docs/is-release-notes-page.ts deleted file mode 100644 index e3c50dfab3..0000000000 --- a/src/lib/docs/is-release-notes-page.ts +++ /dev/null @@ -1,11 +0,0 @@ -/** - * Copyright (c) HashiCorp, Inc. - * SPDX-License-Identifier: MPL-2.0 - */ - -// Hide the version selector on TFE release notes page, e.g. /terraform/enterprise// or /vault/docs/release-notes/1.13.0 -export const isReleaseNotesPage = (path: string) => - /(\/releases\/\d{4}\/(v\d{6}-\d{1}))$/i.test(path) || - /\/release-notes\/(v\d+[.|_]|(\d+[.|_]))\d+[.|_]([0-9]|x)$/i.test(path) - ? true - : false diff --git a/src/views/docs-view/server.ts b/src/views/docs-view/server.ts index 84424c41ed..b60f05a9f2 100644 --- a/src/views/docs-view/server.ts +++ b/src/views/docs-view/server.ts @@ -43,7 +43,6 @@ import { getDeployPreviewLoader } from './utils/get-deploy-preview-loader' import { getCustomLayout } from './utils/get-custom-layout' import type { DocsViewPropOptions } from './utils/get-root-docs-path-generation-functions' import { DocsViewProps } from './types' -import { isReleaseNotesPage } from 'lib/docs/is-release-notes-page' /** * Returns static generation functions which can be exported from a page to fetch docs data @@ -453,11 +452,7 @@ export function getStaticGenerationFunctions< }, projectName: projectName || null, versions: - !hideVersionSelector && - !isReleaseNotesPage(currentPathUnderProduct) && // toggle version dropdown - hasMeaningfulVersions - ? validVersions - : null, + !hideVersionSelector && hasMeaningfulVersions ? versions : null, } return {