Skip to main content

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

Entity

the entity with annotations

dirAnnotation

ParsedLocationAnnotation

the parsed techdocs-ref annotation of type 'dir'

scmIntegrations

ScmIntegrationRegistry

access to the scmIntegration to do url transformations

**Returns:**

{ 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.