How to run jsdoc on whole directory in ubuntu
Asked Answered
A

2

15

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.

Ablative answered 1/11, 2016 at 4:3 Comment(0)
A
27

You can go recursive by passing -r parameter:

$ jsdoc -r .
Agribusiness answered 9/11, 2016 at 10:34 Comment(1)
Recurse into subdirectories when scanning for source files and tutorials. SourceErotomania
O
6

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.

Running JSDoc for a specific directory

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.

Running JSDoc for multiple directories

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.

NOT running JSDoc for some directories

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.

Sources

For more info on the available options for the jsdoc command see here

For more info on the JSDoc configuration file see here

Orangeman answered 6/4, 2022 at 15:32 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.