@@ -9,17 +9,13 @@ function readBranchName(): string {
9
9
}
10
10
11
11
function readOtherLatestReleaseTagNames ( ) : string [ ] {
12
- const currentMajorVersion = semver . major ( version ) ;
13
12
const latestReleaseTagNames = execSync ( 'git tag -l' )
14
13
. toString ( 'utf8' )
15
14
. split ( '\n' )
16
15
. 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
23
19
. reduce < Record < number , string > > ( ( latestTagByMajor , tag ) => {
24
20
const majorVersion = semver . major ( tag ) ;
25
21
@@ -39,10 +35,6 @@ const {
39
35
BRANCH : branchName = readBranchName ( ) ,
40
36
} = process . env ;
41
37
42
- const hiddenLink =
43
- deployContext === 'production'
44
- ? 'https://fakerjs.dev/'
45
- : `https://${ branchName } .fakerjs.dev/` ;
46
38
const otherVersions = readOtherLatestReleaseTagNames ( ) ;
47
39
const isReleaseBranch = / ^ v \d + $ / . test ( branchName ) ;
48
40
@@ -60,11 +52,7 @@ export const versionBannerInfix: string | null = (() => {
60
52
} ) ( ) ;
61
53
62
54
export const currentVersion = isReleaseBranch ? `v${ version } ` : branchName ;
63
- export const oldVersions = [
64
- {
65
- version : 'latest' ,
66
- link : 'https://fakerjs.dev/' ,
67
- } ,
55
+ export const versionLinks = [
68
56
{
69
57
version : 'next' ,
70
58
link : 'https://next.fakerjs.dev/' ,
@@ -73,7 +61,9 @@ export const oldVersions = [
73
61
version,
74
62
link : `https://v${ semver . major ( version ) } .fakerjs.dev/` ,
75
63
} ) ) ,
76
- ] . filter ( ( { link } ) => link !== hiddenLink ) ;
64
+ ]
65
+ // Don't link to the current branch's version.
66
+ . filter ( ( { link } ) => link !== `https://${ branchName } .fakerjs.dev/` ) ;
77
67
78
68
export const algoliaIndex = isReleaseBranch
79
69
? `fakerjs-v${ semver . major ( version ) } `
0 commit comments