Skip to content

Commit

Permalink
Changes to handle a symlink Early Access environment
Browse files Browse the repository at this point in the history
  • Loading branch information
JamesMGreene committed Nov 13, 2020
1 parent dc36bd8 commit 53910e2
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/algolia/find-indexable-pages.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ const loadPages = require('../pages')
module.exports = async function findIndexablePages () {
const allPages = await loadPages()
const indexablePages = allPages
// exclude pages that are part of WIP or hidden products
.filter(page => !page.parentProduct || !page.parentProduct.wip || page.parentProduct.hidden)
// exclude hidden pages
.filter(page => !page.hidden)
// exclude pages that are part of WIP or hidden products
.filter(page => !page.parentProduct || !page.parentProduct.wip || page.parentProduct.hidden)
// exclude index homepages
.filter(page => !page.relativePath.endsWith('index.md'))

Expand Down
11 changes: 11 additions & 0 deletions lib/all-products.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,17 @@ const productsYml = yaml.load(fs.readFileSync(productsFile, 'utf8'))
const sortedProductIds = productsYml.productsInOrder

const contentProductIds = fs.readdirSync(contentDir, { withFileTypes: true })
.map(entry => {
// `fs.readdir` provides file entries based on `fs.lstat`, which doesn't
// resolve symbolic links to their target file/directory. We need to take
// an extra step here to resolve the Early Access symlinked directory.
const { name } = entry
if (entry.isSymbolicLink()) {
entry = fs.statSync(path.join(contentDir, entry.name))
entry.name = name
}
return entry
})
.filter(entry => entry.isDirectory())
.map(entry => entry.name)

Expand Down

0 comments on commit 53910e2

Please sign in to comment.