Description
Describe the bug
If you have a file inside a directory, where the name of the file exists in the directory, then the list-folder
functionality incorrectly removes the part of the directory name which matches the file name.
To Reproduce
Steps to reproduce the behavior:
- Create a file directory
./src/aNamedDirectory/
- In the directory, create a file called
Named.js
- Build the docs
- See that the file is "Excluded"
This is because it is removing the Named
part of the directory, so the file path is incorrect:
./src/aDirectory/Named.js
I think this is just supposed to be removing the filename and extension from the end of the string.
Expected behavior
It shouldn't remove parts of the directory name.
Node (please complete the following information):
- Node-Version: 23.7.0
Additional context
This issue is caused by this line doing an indiscriminate replace:
vuepress-jsdoc/src/lib/list-folder.ts
Line 54 in f696c0f
I think it can be fixed by using path.parse
as mentioned here: https://stackoverflow.com/a/31615711
I've managed to get it working locally, so I'll raise a PR to fix it.