Skip to content

Commit 9386571

Browse files
authored
fix: use named export for all-versions (github#20478)
* fix: use named export for all-versions * run prettier
1 parent 7b9800b commit 9386571

50 files changed

Lines changed: 286 additions & 239 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

components/DefaultLayout.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@ export const DefaultLayout = (props: Props) => {
1818
<Head>
1919
{error === '404' ? (
2020
<title>{t('oops')}</title>
21-
) : (!isHomepageVersion && page.fullTitle) || (currentPathWithoutLanguage.includes('enterprise-server') && page.fullTitle) ? (
21+
) : (!isHomepageVersion && page.fullTitle) ||
22+
(currentPathWithoutLanguage.includes('enterprise-server') && page.fullTitle) ? (
2223
<title>{page.fullTitle}</title>
2324
) : null}
2425

components/article/ArticlePage.tsx

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -54,12 +54,7 @@ export const ArticlePage = () => {
5454
</div>
5555
)}
5656

57-
{intro && (
58-
<div
59-
className="lead-mktg"
60-
dangerouslySetInnerHTML={{ __html: intro }}
61-
/>
62-
)}
57+
{intro && <div className="lead-mktg" dangerouslySetInnerHTML={{ __html: intro }} />}
6358

6459
{permissions && (
6560
<div

components/context/ProductLandingContext.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ export type TocItem = {
66
title: string
77
intro?: string
88
childTocItems?: Array<{
9-
fullPath: string;
10-
title: string;
11-
}>
9+
fullPath: string
10+
title: string
11+
}>
1212
}
1313
export type FeaturedLink = {
1414
title: string

components/landing/GuideCard.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ export const GuideCard = ({ guide }: Props) => {
1313
className="Box color-shadow-medium height-full d-block hover-shadow-large no-underline color-text-primary p-5"
1414
href={guide.href}
1515
>
16-
<h2 dangerouslySetInnerHTML={{__html: guide.title}} />
16+
<h2 dangerouslySetInnerHTML={{ __html: guide.title }} />
1717
<p className="mt-2 mb-4 color-text-tertiary">{guide.intro}</p>
1818

1919
<footer className="d-flex">

components/landing/TableOfContents.tsx

Lines changed: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -24,22 +24,26 @@ export const TableOfContents = (props: Props) => {
2424
return variant === 'compact' ? (
2525
<li key={href} className="f4 my-1">
2626
<Link href={href}>{title}</Link>
27-
<ul className={cx(variant === 'compact' ? 'list-style-circle pl-5 my-3' : 'list-style-none')}>
28-
{(childTocItems || []).map((childItem) => {
29-
if (!childItem) {
30-
return null
31-
}
32-
return (
33-
<li key={childItem.fullPath} className="f4 mt-1">
34-
<Link
35-
href={childItem.fullPath}
36-
className="Bump-link--hover no-underline py-1 color-border-primary"
37-
>
38-
{childItem.title}
39-
</Link>
40-
</li>
41-
)
42-
})}
27+
<ul
28+
className={cx(
29+
variant === 'compact' ? 'list-style-circle pl-5 my-3' : 'list-style-none'
30+
)}
31+
>
32+
{(childTocItems || []).map((childItem) => {
33+
if (!childItem) {
34+
return null
35+
}
36+
return (
37+
<li key={childItem.fullPath} className="f4 mt-1">
38+
<Link
39+
href={childItem.fullPath}
40+
className="Bump-link--hover no-underline py-1 color-border-primary"
41+
>
42+
{childItem.title}
43+
</Link>
44+
</li>
45+
)
46+
})}
4347
</ul>
4448
</li>
4549
) : (

lib/all-versions.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,4 +67,5 @@ plans.forEach((planObj) => {
6767
})
6868
})
6969

70-
export default allVersions
70+
export const allVersionKeys = Object.keys(allVersions)
71+
export { allVersions }

lib/frontmatter.js

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,24 @@ import fs from 'fs'
22
import path from 'path'
33
import parse from './read-frontmatter.js'
44
import semver from 'semver'
5-
import xAllVersions from './all-versions.js'
5+
import { allVersions } from './all-versions.js'
66

7-
const layoutNames = ['default', 'dev-toc', 'graphql-explorer', 'product-landing', 'product-sublanding', 'release-notes', false]
7+
const layoutNames = [
8+
'default',
9+
'dev-toc',
10+
'graphql-explorer',
11+
'product-landing',
12+
'product-sublanding',
13+
'release-notes',
14+
false,
15+
]
816
const semverValidRange = semver.validRange
917
const semverRange = {
1018
type: 'string',
1119
conform: semverValidRange,
1220
message: 'Must be a valid SemVer range',
1321
}
14-
const versionObjs = Object.values(xAllVersions)
22+
const versionObjs = Object.values(allVersions)
1523
const guideTypes = ['overview', 'quick_start', 'tutorial', 'how_to', 'reference']
1624
const featureVersions = fs
1725
.readdirSync(path.posix.join(process.cwd(), 'data/features'))

lib/get-applicable-versions.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { fileURLToPath } from 'url'
22
import path from 'path'
33
import { reduce, sortBy } from 'lodash-es'
4-
import allVersions from './all-versions.js'
4+
import { allVersions } from './all-versions.js'
55
import versionSatisfiesRange from './version-satisfies-range.js'
66
import checkIfNextVersionOnly from './check-if-next-version-only.js'
77
import dataDirectory from './data-directory.js'

lib/non-enterprise-default-version.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import xAllVersions from '../lib/all-versions.js'
2-
const nonEnterpriseDefaultVersion = Object.values(xAllVersions).find(
1+
import { allVersions } from '../lib/all-versions.js'
2+
const nonEnterpriseDefaultVersion = Object.values(allVersions).find(
33
(version) => version.nonEnterpriseDefault
44
).version
55

lib/old-versions-utils.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@ import path from 'path'
22
import { supported, latest } from './enterprise-server-releases.js'
33
import patterns from './patterns.js'
44
import nonEnterpriseDefaultVersion from './non-enterprise-default-version.js'
5-
import xAllVersions from './all-versions.js'
5+
import { allVersions } from './all-versions.js'
66
const latestNewVersion = `enterprise-server@${latest}`
77
const oldVersions = ['dotcom'].concat(supported)
8-
const newVersions = Object.keys(xAllVersions)
8+
const newVersions = Object.keys(allVersions)
99

1010
// Utility functions for converting between old version paths and new version paths.
1111
// See lib/path-utils.js for utility functions based on new paths.

0 commit comments

Comments
 (0)