Security News
Input Validation Vulnerabilities Dominate MITRE's 2024 CWE Top 25 List
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
ngx-doc-gen
Advanced tools
Automatically generate your library's API docs using Angular CLI or NX.
The initial spark was given by the folks from the Angular team (angular/components) who are using a perfectly working base implementation on documentation generation utilizing Dgeni.
Props to those who deserve it 🍻
Most of the code as well as the templates and styles originate from their repository.
Using NX:
npm install --save-dev ngx-doc gen
nx generate ngx-doc-gen:configure
Using Angular CLI
ng add ngx-doc-gen
Those calls will add a doc-gen
target similiar to the build
one to all touched library projects.
Using NX:
nx run <project>:doc-gen
Using Angular CLI:
ng doc-gen <project>
While generation is running ngx-doc-gen will scan the given library for its entrypoints - or entrypoint if there is just one - and extract the public API. The heavy lifting is done by Dgeni.
After extraction it categorizes your API in like modules, services, etc. - just like its done when looking at the Angular Material docs - and processes specific templates.
After everything is done ngx-doc-gen will output an HTML file per entrypoint into the output directory (read on for configuration).
configure
/ ng add
)--projects
string[]
[]
ng generate ngx-doc-gen:configure --projects lib-a,lib-b
ng add ngx-doc-gen --projects lib-a,lib-b
If not provided or left empty - the default - configure
(Generator) and ng add
(Angular CLI) will scan your workspace for all buildable library projects and condigures them for documentation generation.
--log-level
'error' | 'warn' | 'debug' | 'verbose'
'warn'
--output-path
Path
'docs'
--exclude-base
string[]
[]
Observable
which would include members like subscribe()
in your documentation. This could be prevented as follows:--exclude-base Observable
--docs-public
string
docs-public
--docs-private
string
,docs-private
--breaking-change
string
,breaking-change
angular.json
/ workspace.json
/ project.json
)Every CLI parameter can also be bound to the doc-gen
target in your workspace configuration so you don't have to pass them on every CLI call - see example below.
Some parameters can be passed by configuration only.
customTags
TagDefinition[]
[]
Property | Type | Description |
---|---|---|
name | string | Name of the tag (excluding the @ ) |
docProperty? | string | Property where the tag information should be attached to. |
multi? | boolean | Whether multiple instances of the tag can be used in the same comment. |
required? | boolean | Whether this tag is required for all API documents. |
// Example given for a project.json
...
"<project>": {
"targets": {
"doc-gen": {
"executor": "ngx-doc-gen:generate",
"options": {
"logLevel": "verbose",
"outputPath": "./docs/libs/<project>",
"excludeBase": [
"Observable"
],
"customTags": [
{
"name": "example"
}
]
}
}
}
}
...
As the generated docs are just plain HTML files you apply whatever styling you want. For convinience ngx-doc-gen comes with two SCSS mixins.
core
Applies some general styles for font, spacing, borders, etc. Just include the mixing in your root stylesheet.
@use 'ngx-doc-gen/styles' as ngx-doc-gen;
@include ngx-doc-gen.core();
docs-theme
Applies some Angular Material touch. Just pass your Angular Material theme into the mixin.
@use 'ngx-doc-gen/styles/theming' as ngx-doc-gen;
@include ngx-doc-gen.docs-theme($theme);
FAQs
Automagically generate your Angular documentation.
The npm package ngx-doc-gen receives a total of 8 weekly downloads. As such, ngx-doc-gen popularity was classified as not popular.
We found that ngx-doc-gen demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.
Research
Security News
A threat actor's playbook for exploiting the npm ecosystem was exposed on the dark web, detailing how to build a blockchain-powered botnet.