mirror of
https://github.com/ianstormtaylor/slate.git
synced 2025-01-19 14:27:07 +01:00
cedc7dc2a5
* fix import extensions of eslint * revert next.config.cjs * fix eslint globbing * add migrating to docs’ sidebar * fix prettier error on Contributing.md * put quotes for glob matching for windows user * remove type: module from package.json
24 lines
526 B
JavaScript
24 lines
526 B
JavaScript
const fs = require('fs')
|
|
const path = require('path')
|
|
|
|
module.exports = {
|
|
exportPathMap: async (defaultPathMap, config) => {
|
|
const { dir } = config
|
|
const examples = fs.readdirSync(path.resolve(dir, 'examples'))
|
|
const pages = {
|
|
'/': { page: '/' },
|
|
}
|
|
|
|
for (const file of examples) {
|
|
if (!file.endsWith('.js')) {
|
|
continue
|
|
}
|
|
|
|
const example = file.replace('.js', '')
|
|
pages[`/examples/${example}`] = { page: '/examples/[example]', example }
|
|
}
|
|
|
|
return pages
|
|
},
|
|
}
|