(WIP): Add ability to generate documentation from auto-generated typings #1007
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Adds the ability to generate documentation web-pages from the auto-generated typings.
Currently, the repository is an intermediate state where all but some of the services have the ability to auto-generate typings (namely auth, machine-learning and storage cannot). In the current TypeDoc setup, we cannot generate the documentation web-pages when relying only on the auto-generated
d.ts
files.Note: This is still WIP.
Background
The first observation is that the generated filenames were incorrect; more specifically the namespace prefix was missing (i.e.,
credential.html
vsadmin.credential.credential.html
).Formerly,
modules
mode for TypeDoc was attempted but it was found that some of the generated.html
files had different composition, so another approach is taken here.In short, the purpose of choosing
modules
is the generated typings from TypeDoc doesn't including the namespace prefix in the filename, but by switching tomodules
the folder name is prefixed allowing us to interpolate, as here:firebase-admin-node/docgen/generate-docs.js
Lines 293 to 373 in ebf660d
Approach
This PR takes the approach of using TypeDoc's
file
mode as it is using today. Now, thesrc
folder is traversed and the barrel export files are introspected to determine the namespace prefix instead.The technique chosen is to build an index mapping type-names to their parent folder name based on
src
. The underlying assumption for this is that the folder-name corresponds to the namespace (does not apply forcredential
but I addressed it in another PR) and type names are unique (does not apply forquery
so far, but this can be manually patched).Additional Issues
implements: any
(can be resolved via regex)INTERNAL
should not appear (can be resolved via regex)Accessors
is actuallyProperties
app: FirebaseApp
vsapp: _admin.app.App
(can be resolved via regex)@hidden
)export import
pattern, the exported types appear as variables (can be resolved via regex)TypeDoc
in order forexport import
to even appear (went up from0.15.0
to0.18.0
)0.16.0
For example:
Several other minor fixes:
.html
link onindex.html
for service pages when run locally