@@ -9,17 +9,13 @@ function readBranchName(): string {
99}
1010
1111function readOtherLatestReleaseTagNames ( ) : string [ ] {
12- const currentMajorVersion = semver . major ( version ) ;
1312 const latestReleaseTagNames = execSync ( 'git tag -l' )
1413 . toString ( 'utf8' )
1514 . split ( '\n' )
1615 . filter ( ( tag ) => semver . valid ( tag ) )
17- . filter ( ( tag ) => {
18- // Only consider tags for our deployed website versions,
19- // excluding the current major version.
20- const majorVersion = semver . major ( tag ) ;
21- return majorVersion >= 6 && majorVersion !== currentMajorVersion ;
22- } )
16+ // Only consider tags for our deployed website versions
17+ . filter ( ( tag ) => semver . major ( tag ) >= 6 )
18+ // Find the latest tag for each major version
2319 . reduce < Record < number , string > > ( ( latestTagByMajor , tag ) => {
2420 const majorVersion = semver . major ( tag ) ;
2521
@@ -39,10 +35,6 @@ const {
3935 BRANCH : branchName = readBranchName ( ) ,
4036} = process . env ;
4137
42- const hiddenLink =
43- deployContext === 'production'
44- ? 'https://fakerjs.dev/'
45- : `https://${ branchName } .fakerjs.dev/` ;
4638const otherVersions = readOtherLatestReleaseTagNames ( ) ;
4739const isReleaseBranch = / ^ v \d + $ / . test ( branchName ) ;
4840
@@ -60,11 +52,7 @@ export const versionBannerInfix: string | null = (() => {
6052} ) ( ) ;
6153
6254export const currentVersion = isReleaseBranch ? `v${ version } ` : branchName ;
63- export const oldVersions = [
64- {
65- version : 'latest' ,
66- link : 'https://fakerjs.dev/' ,
67- } ,
55+ export const versionLinks = [
6856 {
6957 version : 'next' ,
7058 link : 'https://next.fakerjs.dev/' ,
@@ -73,7 +61,9 @@ export const oldVersions = [
7361 version,
7462 link : `https://v${ semver . major ( version ) } .fakerjs.dev/` ,
7563 } ) ) ,
76- ] . filter ( ( { link } ) => link !== hiddenLink ) ;
64+ ]
65+ // Don't link to the current branch's version.
66+ . filter ( ( { link } ) => link !== `https://${ branchName } .fakerjs.dev/` ) ;
7767
7868export const algoliaIndex = isReleaseBranch
7969 ? `fakerjs-v${ semver . major ( version ) } `
0 commit comments