Lab 10: Compodoc
π Resourcesβ
π Starter Codeβ
step-10-album-wholesale-v16-post-prefetch-resolve
In this lab, you'll generate comprehensive project documentation using Compodoc. You'll install the tool, add JSDoc comments to your code, configure npm scripts, and serve interactive documentation for your Angular application.
π Instructionsβ
Step 1: Install Compodocβ
npm install --save-dev @compodoc/compodoc
Step 2: Add JSDoc Commentsβ
Add documentation to your code:
/**
* Service for managing album data
*/
@Injectable({ providedIn: 'root' })
export class AlbumService {
/**
* Retrieves all albums
* @returns Observable of albums
*/
getAlbums(): Observable<Album[]> {
return this.http.get<Album[]>(this.apiUrl);
}
}
Step 3: Add npm Scriptβ
In package.json:
{
"scripts": {
"compodoc:serve": "compodoc -p tsconfig.json -s"
}
}
Step 4: Generate Documentationβ
npm run compodoc:serve
This opens documentation at http://localhost:8080