mirror of
https://github.com/facebook/docusaurus.git
synced 2025-05-02 19:57:25 +02:00
18 lines
397 B
JavaScript
18 lines
397 B
JavaScript
const globby = require('globby');
|
|
const {encodePath, fileToPath} = require('./utils');
|
|
|
|
async function loadPages(pagesDir) {
|
|
const pagesFiles = await globby(['**/*.js'], {
|
|
cwd: pagesDir
|
|
});
|
|
|
|
const pagesData = await Promise.all(
|
|
pagesFiles.map(async source => ({
|
|
path: encodePath(fileToPath(source)),
|
|
source
|
|
}))
|
|
);
|
|
return pagesData;
|
|
}
|
|
|
|
module.exports = loadPages;
|