Merge branch 'imjohnbo-content-plan-6764' of https://github.com/github/docs-internal into imjohnbo-content-plan-6764
This commit is contained in:
@@ -1,14 +1,17 @@
|
||||
import { next, latest } from './enterprise-server-releases.js'
|
||||
import versionSatisfiesRange from './version-satisfies-range.js'
|
||||
|
||||
// Special handling for frontmatter that evalues to the next GHES release number or a hardcoded `next`:
|
||||
// we don't want to return it as an applicable version or it will become a permalink,
|
||||
// but we also don't want to throw an error if no other versions are found.
|
||||
// Special handling for frontmatter that evalues to the next GHES release number,
|
||||
// GHAE `issue-\d{4}` or a hardcoded `next`. We don't want to return any of these
|
||||
// as an applicable version or it will become a permalink, but we also don't want
|
||||
// to throw an error if no other versions are found.
|
||||
export default function checkIfNextVersionOnly(value) {
|
||||
if (value === '*') return false
|
||||
|
||||
const ghesNextVersionOnly =
|
||||
const ghesNextVersion =
|
||||
versionSatisfiesRange(next, value) && !versionSatisfiesRange(latest, value)
|
||||
|
||||
return ghesNextVersionOnly || value === 'next'
|
||||
const ghaeUpcomingVersion = value.includes('issue-')
|
||||
|
||||
return ghesNextVersion || ghaeUpcomingVersion || value === 'next'
|
||||
}
|
||||
|
||||
@@ -73,7 +73,7 @@ function getApplicableVersions(frontmatterVersions, filepath) {
|
||||
!foundFeatureVersions.isNextVersionOnly
|
||||
) {
|
||||
throw new Error(
|
||||
`No applicable versions found for ${filepath}. Please double-check the page's \`versions\` frontmatter.`
|
||||
`${filepath} is not available in any currently supported version. Make sure the \`versions\` property includes at least one supported version.`
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ export default function features(req, res, next) {
|
||||
// Determine whether the currentVersion belongs to the list of versions the feature is available in.
|
||||
Object.keys(req.context.site.data.features).forEach((featureName) => {
|
||||
const { versions } = req.context.site.data.features[featureName]
|
||||
const applicableVersions = getApplicableVersions(versions, req.path)
|
||||
const applicableVersions = getApplicableVersions(versions, `data/features/${featureName}.yml`)
|
||||
|
||||
// Adding the resulting boolean to the context object gives us the ability to use
|
||||
// `{% if featureName ... %}` conditionals in content files.
|
||||
|
||||
Reference in New Issue
Block a user