Pasting a URL like `https://github.com/RoadieHQ/sample-service/blob/master/catalog-info-1.yaml`
into the Register Existing Component input creates an Entity with the
the `backstage.io/managed-by-location` annotation set to the `type` of
`url.
The TechDocs perparer does not handle this type.
```ts
switch (type) {
case 'github':
case 'gitlab':
case 'azure/api': {
// ...
}
case 'file':
// ...
default:
throw new InputError(`Unable to resolve location type ${type}`);
}
}
```
Thus, docs are never generated and we see the following error when
trying to view then in Backstage.
```
InputError: Unable to resolve location type url at DirectoryPreparer.resolveManagedByLocationToDir (webpack-internal:///../../node_modules/@backstage/plugin-techdocs-backend/src/techdocs/stages/prepare/dir.ts:63:15) at DirectoryPreparer.prepare (webpack-internal:///../../node_modules/@backstage/plugin-techdocs-backend/src/techdocs/stages/prepare/dir.ts:73:51) at DocsBuilder.build (webpack-internal:///../../node_modules/@backstage/plugin-techdocs-backend/src/service/helpers.ts:74:45) at eval (webpack-internal:///../../node_modules/@backstage/plugin-techdocs-backend/src/service/router.ts:141:25) at processTicksAndRejections (internal/process/task_queues.js:93:5)
```
This may not be the correct solution. An alternative solution would be
to ensure that pasted URLs end up with the `type` of `github` rather
than `url`.
Plus
1. Introduce ncessary configs to connect with storage
2. Introduce config to prefer CI build of docs, or techdocs-backend to build and publish them.
3. Write guide how to use Google Cloud Storage with TechDocs
4. Add a TechDocs Configuration reference page in docucmentation
If a backstage App wants to enable techdocs plugin, it should only have to care about installing @backstage/plugin-techdocs and @backstage/plugin-techdocs-backend.
@backstage/plugin-techdocs-backend should re-export necessary APIs from techdocs-common
1. Don't use mkdocs in name of APIs or variables. It is an implementation detail and liable to change in future.
2. techDocsApi.getMetadata('mkdocs') and techDocsAPI.getMetadata('entity') should be two separate functions just because their responses differ in structure. They should also be type checked.
3. Use either 'techdocs' or 'TechDocs' consistently. 'techDocs' seems like an unnecessary third way to write TechDocs, which can be avoided.
4. Remove unused /plugins/techdocs-backend/src/service/metadata.ts file
* TechDocs: Logger already prints the name of plugin
* TechDocs: Display a custom error message if provided
* TechDocs: throw custom error message if index.md is not present
* Language improvements. Thanks @freben
Co-authored-by: Fredrik Adelöw <freben@gmail.com>
Co-authored-by: Fredrik Adelöw <freben@gmail.com>
* Basic implementation of readTree on github and use it in techdocs
* Added a UrlPreparer and cleaned up some minor things
* Download entire archive and filter out the wanted files in readTree
* Added test for dir output of tree reader
* Fixed formatting
* Fixed formatting
* Some cleanups and fixes
* Fix typing issues
* Fix prettier
* Fix prettier
* Removed unused dependency
* Fixed comments on PR
* Prettier
* Moved @types/fs-extra to devDeps
* Fixed another PR comment
* Added a test for getDocFilesFromRepository
* Prettier