@alauda/doom 0.2.6 → 0.2.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -14,10 +14,12 @@ const sidebarSorter = (a, b) => {
|
|
|
14
14
|
*/
|
|
15
15
|
const splitSideMeta = (sideMeta, extensions) => {
|
|
16
16
|
const result = sideMeta.reduce((acc, curr) => {
|
|
17
|
+
let fileParts;
|
|
17
18
|
if ('_fileKey' in curr &&
|
|
18
19
|
!('items' in curr) &&
|
|
19
20
|
!acc.index &&
|
|
20
|
-
|
|
21
|
+
(fileParts = curr._fileKey?.split('/')) &&
|
|
22
|
+
extensions.some((ext) => fileParts.at(-1) === `index${ext}`)) {
|
|
21
23
|
acc.index = curr;
|
|
22
24
|
}
|
|
23
25
|
else {
|
|
@@ -185,7 +187,6 @@ export async function walk(workDir, routePrefix = '/', docsDir, extensions) {
|
|
|
185
187
|
});
|
|
186
188
|
const { index, others } = await scanSideMeta(workDir, workDir, docsDir, routePrefix, extensions, ['assets', 'public', 'shared']);
|
|
187
189
|
const sidebars = index ? [index, ...others] : others;
|
|
188
|
-
sidebars.sort(sidebarSorter);
|
|
189
190
|
// Every sub dir will represent a group of sidebar
|
|
190
191
|
const sidebarConfig = {
|
|
191
192
|
[routePrefix]: sidebars,
|