Extract method to register start page for component version
Currently, the logic to register the start page for the component version is embedded inside the ContentCatalog#registerComponentVersion()
method. This has several consequences:
- It cannot be called independently
- The logic is coupled with component version registration (so it can't be disabled)
- It assumes the files for the component version have already been added to the catalog (which is counter-intuitive)
The benefit of the current arrangement is that the url
property is guaranteed to be set on the component version when it is registered. So it's slightly simpler (despite the backwards call order).
The proposed signature for this method is as follows:
registerComponentVersionStartPage({ name, version }, startPageSpec)
For example:
contentCatalog.registerComponentVersionStartPage({ name: 'the-component', version: '1.0' }, 'intro.adoc')
The component version information comes first so that the method can be easily called without a start page spec, in which case the method will look for the default start page:
contentCatalog.registerComponentVersionStartPage({ name: 'the-component', version: '1.0' })
The component version arguments are bundled as an object because, ideally, it would be possible to pass a component version object. For example:
contentCatalog.registerComponentVersionStartPage(componentVersion)
However, the component version object currently doesn't have the name property, so this would need to be a custom object until that is resolved / decided.