* Move lib/search/sync.js to script/search/sync.js * Move mdast-util-from-markdown to devDeps * Move lib/redirects/add-redirect-to-frontmatter.js to script/helpers/ * Move mkdirp to devDeps * Move linkinator to devDeps * Move rimraf to devDeps * Fix script/search/sync.js require paths * Move lib/search/build-records.js to script/search/ * Move lib/search/find-indexable-pages to script/search/ * Fix require paths for build-records * Fix require paths for find-indexable-pages * Move lib/search/algolia-get-remote-index-names.js to script/search/ * Movbe lib/search/algolia-search-index.js to script/search/ * Move lib/search/lunr-search-index.js to script/search/ * Move lib/search/lunr-get-index-names.js to script/search/ * Fix Lunr search index paths * Move lib/search/validate-records.js to script/search/ * Move is-url to devDeps * Move lib/search/algolia-client.js to script/search/ * Move lib/search/parse-page-sections-into-records.js to script/search/ * Move lib/search/rank.js to script/search/ * Fix path to cached-index-names.json file * Normalize require for fs.promises
15 lines
492 B
JavaScript
15 lines
492 B
JavaScript
const { namePrefix } = require('../../lib/search/config')
|
|
const getAlgoliaClient = require('./algolia-client')
|
|
|
|
module.exports = async function getRemoteIndexNames () {
|
|
const algoliaClient = getAlgoliaClient()
|
|
const indices = await algoliaClient.listIndices()
|
|
|
|
// ignore other indices that may be present in the Algolia account like `helphub-`, etc
|
|
const indexNames = indices.items
|
|
.map(field => field.name)
|
|
.filter(name => name.startsWith(namePrefix))
|
|
|
|
return indexNames
|
|
}
|