Skip to content

Commit b59411e

Browse files
committed
fix(test): move replacement of filename up
1 parent c9694a3 commit b59411e

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

example/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
"main": "index.js",
66
"scripts": {
77
"docs": "../bin/vuepress-jsdoc.js --jsDocConfigPath ./jsdoc.json --source=./src --dist=./documentation --title=API --exclude=class.js --partials=./partials/*.hbs --readme=./README.md",
8+
"docs:dev": "npm run docs -- --watch",
89
"dev": "npm run docs && vuepress dev documentation",
910
"build": "npm run docs && vuepress build documentation"
1011
},

src/lib/list-folder.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,10 @@ export const listFolder = async (srcPath: string, exclude: string[] = [], mainPa
2626
const ext = path.extname(filePath);
2727
let name = path.basename(filePath).replace(ext, '');
2828

29+
if (name === 'index') {
30+
name = '_index';
31+
}
32+
2933
const file = {
3034
isDir,
3135
name,
@@ -37,10 +41,6 @@ export const listFolder = async (srcPath: string, exclude: string[] = [], mainPa
3741
if (name.toLowerCase() === 'readme') continue;
3842

3943
if (!mm.isMatch(path.join(srcPath.replace(mainPath || srcPath, ''), dirent.name), exclude)) {
40-
if (name === 'index') {
41-
name = '_index';
42-
}
43-
4444
const treeEntry: FileTree = {
4545
name,
4646
...(!isDir ? { path: `/${name}`, fullPath: path.join(srcPath, name), ext } : {})

0 commit comments

Comments
 (0)