-
Notifications
You must be signed in to change notification settings - Fork 712
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unable to doc file located in a dir with []
#2825
Comments
typedoc does not escape special characters in the file names huh. Edit: Testing it on my own, it does work. but including that file from the CLI did not work.
|
This is working as expected. The paths provided to TypeDoc as entry points are sets of globs, not sets of paths.
The escaping here is for your shell, not TypeDoc, so TypeDoc receives
This will work as TypeDoc will receive |
Thanks! Could you add some details to the document: https://typedoc.org/documents/Options.Input.html#entrypoints It isn't clear that the entry point is a set of globs. |
Which shell are you using? Using bash, The command isn't working for me $ npx typedoc src/\[abc\]/a.ts
[warning] The glob ./src/[abc]/a.ts did not match any files
[error] Unable to find any entry points. See previous warnings
[error] Found 1 errors and 1 warnings
I made a new project, with default tsconfig (from
Enclosing the entry point to prevent shell's intervention, it probably throws an uncaught error (with stack trace) ?
|
@phoneticallySAARTHaK In bash, you need to run: Note the single quotes, which prevent bash from escaping the argument. |
I get the same error with single or double quotes. Weird. Using node v20.17.0 on linux kernel 6.12.4-arch1-1 Edit: Don't know why both node and python are doing this, while More infoFor some reason, the Tested with simple program that prints its args, both in python and node, the output was the same.
This is the code I used. const args = process.argv.slice(2);
console.log("CLI Arguments:", args); |
Actually there might still be a typedoc bug here. If I replace the last step with $ typedoc '\[abc\]/a.ts'
TypeDoc exiting with unexpected error:
Error: ENOENT: no such file or directory, scandir '/home/hong/tmp//[abc/]'
at Module.readdirSync (node:fs:1502:26)
at discoverFiles (file:///home/hong/.nvm/versions/node/v22.12.0/lib/node_modules/typedoc/dist/lib/utils/fs.js:211:32)
at glob (file:///home/hong/.nvm/versions/node/v22.12.0/lib/node_modules/typedoc/dist/lib/utils/fs.js:252:12)
at file:///home/hong/.nvm/versions/node/v22.12.0/lib/node_modules/typedoc/dist/lib/utils/entry-point.js:215:24
at Array.flatMap (<anonymous>)
at expandGlobs (file:///home/hong/.nvm/versions/node/v22.12.0/lib/node_modules/typedoc/dist/lib/utils/entry-point.js:214:31)
at getEntryPoints (file:///home/hong/.nvm/versions/node/v22.12.0/lib/node_modules/typedoc/dist/lib/utils/entry-point.js:91:53)
at Application.getDefinedEntryPoints (file:///home/hong/.nvm/versions/node/v22.12.0/lib/node_modules/typedoc/dist/lib/application.js:311:20)
at Application.getEntryPoints (file:///home/hong/.nvm/versions/node/v22.12.0/lib/node_modules/typedoc/dist/lib/application.js:302:29)
at Application.convert (file:///home/hong/.nvm/versions/node/v22.12.0/lib/node_modules/typedoc/dist/lib/application.js:330:38) {
errno: -2,
code: 'ENOENT',
syscall: 'scandir',
path: '/home/hong/tmp//[abc/]'
} Looks like TypeDoc somehow replaces backslashes with forward slashes. Additional context, shell does not escape in this case: $ echo '\[abc\]/a.ts'
\[abc\]/a.ts |
Search terms
file path
Expected Behavior
typedoc
should be able to recognize file paths containing[abc]
. This kind of odd path names (along with[...abc]
) are required by a commonly used feature in next.js: https://nextjs.org/docs/app/building-your-application/routing/dynamic-routesActual Behavior
If a file path contains
[abc]
, typedoc generates an error.Steps to reproduce the bug
mkdir \[abc\]
touch \[abc\]/a.ts
typedoc \[abc\]/a.ts
TypeDoc generates:
Also error out even if the current working directory is inside
[abc]/
.Environment
The text was updated successfully, but these errors were encountered: