mirror of
https://github.com/explosion/spaCy.git
synced 2025-02-11 17:10:36 +03:00
Extract function
This will make the next commit easier to read
This commit is contained in:
parent
aea5496788
commit
4151870c9f
|
@ -25,12 +25,18 @@ type ParsedUrlQuery = {
|
|||
}
|
||||
|
||||
export const getStaticPaths: GetStaticPaths<ParsedUrlQuery> = async () => {
|
||||
return {
|
||||
paths: fs.readdirSync(path.join('docs')).map((filename) => ({
|
||||
// This function needs to be defined inside `getStaticPath` to be executed in executed in the correct context
|
||||
const loadFolder = (): Array<{ params: ParsedUrlQuery }> =>
|
||||
fs
|
||||
.readdirSync(path.join('docs'))
|
||||
.map((filename) => ({
|
||||
params: {
|
||||
slug: filename.replace('.mdx', ''),
|
||||
},
|
||||
})),
|
||||
}))
|
||||
|
||||
return {
|
||||
paths: loadFolder(),
|
||||
fallback: false,
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user