Skip to content

Commit

Permalink
fix(test): move replacement of filename up
Browse files Browse the repository at this point in the history
  • Loading branch information
ph1p committed Sep 2, 2021
1 parent c9694a3 commit b59411e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
1 change: 1 addition & 0 deletions example/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"main": "index.js",
"scripts": {
"docs": "../bin/vuepress-jsdoc.js --jsDocConfigPath ./jsdoc.json --source=./src --dist=./documentation --title=API --exclude=class.js --partials=./partials/*.hbs --readme=./README.md",
"docs:dev": "npm run docs -- --watch",
"dev": "npm run docs && vuepress dev documentation",
"build": "npm run docs && vuepress build documentation"
},
Expand Down
8 changes: 4 additions & 4 deletions src/lib/list-folder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ export const listFolder = async (srcPath: string, exclude: string[] = [], mainPa
const ext = path.extname(filePath);
let name = path.basename(filePath).replace(ext, '');

if (name === 'index') {
name = '_index';
}

const file = {
isDir,
name,
Expand All @@ -37,10 +41,6 @@ export const listFolder = async (srcPath: string, exclude: string[] = [], mainPa
if (name.toLowerCase() === 'readme') continue;

if (!mm.isMatch(path.join(srcPath.replace(mainPath || srcPath, ''), dirent.name), exclude)) {
if (name === 'index') {
name = '_index';
}

const treeEntry: FileTree = {
name,
...(!isDir ? { path: `/${name}`, fullPath: path.join(srcPath, name), ext } : {})
Expand Down

0 comments on commit b59411e

Please sign in to comment.