I installed the documentation tool "Compodoc" in my Angular application. First, I installed the tool globally and in my project
npm install -g @compodoc/compodoc
npm install --save-dev @compodoc/compodoc
I added the command to my package.json file in the "scripts" area with the following line
"compodoc": "./node_modules/.bin/compodoc -p src/tsconfig.app.json"
And it generated me the entire documentation files with this command :
npm run compodoc
Everything went good until I tried to run the command compodoc -s
to see the documentation in my browser.
compodoc: command not found
Just run "./node_modules/.bin/compodoc -s"
In your package.json, for "compodoc" have the options you require and just run "npm run compodoc". For Example: "compodoc": "./node_modules/.bin/compodoc -p tsconfig-compodoc.json -d docs -n \"My Document Name\" --serve --port 3003 --theme postmark --hideGenerator --watch"
It should run. Hope it helped. Thanks:)
Adding this for Angular 9 users:
tell it to create the documentation elsewhere so that 'ng serve' doesn't get confused by the changes caused by the documentation folder if you are using the 'w' folder
Add this package. json then you can run 'npm run compodoc'. Also, In Angular 9, now I see that I have to specify what folder to watch as well - '-w' means watch the source folder.
"scripts": { "ng": "ng", "start": "ng serve", "build": "ng build", "test": "ng test", "lint": "ng lint", "e2e": "ng e2e", "compodoc": "./node_modules/.bin/compodoc -p tsconfig.json -w ./src -s --output ../Path To where you want the documentation/documentation --silent" },
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