1
0
mirror of synced 2025-12-20 18:36:31 -05:00

update references

This commit is contained in:
Sarah Schneider
2021-04-01 15:29:59 -04:00
parent 229549621d
commit c7f647f68a
9 changed files with 32 additions and 36 deletions

View File

@@ -2,7 +2,7 @@ const slash = require('slash')
const path = require('path')
const patterns = require('./patterns')
const { latest } = require('./enterprise-server-releases')
const allProducts = require('./all-products')
const { productIds } = require('./all-products')
const allVersions = require('./all-versions')
const supportedVersions = new Set(Object.keys(allVersions))
const nonEnterpriseDefaultVersion = require('./non-enterprise-default-version')
@@ -43,7 +43,7 @@ function getVersionStringFromPath (href) {
const versionFromPath = href.split('/')[1]
// If the first segment is a supported product, assume this is FPT
if (allProducts[versionFromPath]) {
if (productIds.includes(versionFromPath)) {
return nonEnterpriseDefaultVersion
}
@@ -85,7 +85,7 @@ function getProductStringFromPath (href) {
if (pathParts.includes('early-access')) return 'early-access'
return allProducts[pathParts[2]]
return productIds.includes(pathParts[2])
? pathParts[2]
: pathParts[1]
}
@@ -99,20 +99,13 @@ function getCategoryStringFromPath (href) {
if (pathParts.includes('early-access')) return null
const productIndex = allProducts[pathParts[2]]
const productIndex = productIds.includes(pathParts[2])
? 2
: 1
return pathParts[productIndex + 1]
}
// Return the corresponding object for the product segment in a path
function getProductObjectFromPath (href) {
const productFromPath = getProductStringFromPath(href)
return allProducts[productFromPath]
}
module.exports = {
getPathWithLanguage,
getPathWithoutLanguage,
@@ -120,6 +113,5 @@ module.exports = {
getVersionStringFromPath,
getVersionObjectFromPath,
getProductStringFromPath,
getCategoryStringFromPath,
getProductObjectFromPath
getCategoryStringFromPath
}