transformDirLocation()
Home > @backstage/plugin-techdocs-node
> transformDirLocation
TechDocs references of type dir
are relative the source location of the entity. This function transforms relative references to absolute ones, based on the location the entity was ingested from. If the entity was registered by a url
location, it returns a url
location with a resolved target that points to the targeted subfolder. If the entity was registered by a file
location, it returns an absolute dir
location.
Signature:
transformDirLocation: (entity: Entity, dirAnnotation: ParsedLocationAnnotation, scmIntegrations: ScmIntegrationRegistry) => {
type: 'dir' | 'url';
target: string;
}
Parameters
Parameter |
Type |
Description |
---|---|---|
entity |
the entity with annotations | |
dirAnnotation |
the parsed techdocs-ref annotation of type 'dir' | |
scmIntegrations |
access to the scmIntegration to do url transformations |
{ type: 'dir' | 'url'; target: string; }
the transformed location with an absolute target.
Exceptions
if the entity doesn't specify a dir
location or is ingested from an unsupported location.