I just need to run jsdoc on ai whole directory containing .js files, I am doing this on individual files in ubuntu terminal by issuing command jsdoc abc.js but what I need is to apply this command on all files in the directory at once,so that all files in that directory containg js files would be generated by a single command. Thanks for any help you would give.
You can use most JSDoc type syntax and any TypeScript syntax, from the most basic like string to the most advanced, like conditional types.
JSDoc is a markup language used to annotate JavaScript source code files. Using comments containing JSDoc, programmers can add documentation describing the application programming interface of the code they're creating.
Even though it's only asked how to run JSDoc for a specific directory, I think this thread could use some more information so people reading this can be aware of other strategies that could be useful.
This is the simplest one and the direct answer to the question. You can run JSDoc for all files inside a directory using the --recurse
or -r
option.
Example:
$ jsdoc -r ./src/
This will run JSDoc for all files inside the src/
directory and its subdirectories.
This and the following sections aren't exactly what the question asked for but hopefully will be useful for people using a search engine that found this thread.
You'll probably need to run JSDoc for all the files located in different directories. For this you can just use multiple arguments with the --recurse
option.
Example:
$ jsdoc -r ./client/ ./server/
This will run JSDoc for all files inside both client/
and server/
and its subdirectories.
This is slightly more complicated and will require use of JSDoc's configuration file. After creating the configuration file, you can run JSDoc using the --configure
(or -c
) option to select the configuration file you want to use.
Example:
Create a file conf.json
as shown bellow:
{
"source": {
"include": [ "." ],
"exclude": [ "node_modules/" ]
}
}
Then run JSDoc like that:
jsdoc -c ./conf.json -r
With that JSDoc will be run for all files inside your current directory and its subdirectories except for the ones located inside node_modules/
and its subdirectories.
For more info on the available options for the jsdoc
command see here
For more info on the JSDoc configuration file see here
You can go recursive by passing -r parameter:
$ jsdoc -r .
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With