todo-backend: add support for configuring the default parser

Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
This commit is contained in:
Patrik Oldsberg
2021-03-11 21:23:17 +01:00
parent ebeb76822a
commit fd45472213
6 changed files with 84 additions and 24 deletions
+21
View File
@@ -35,3 +35,24 @@ export default async function createPlugin({
return await createRouter({ todoService });
}
```
## Parser Configuration
The `TodoScmReader` accepts a `TodoParser` option, which can be used to configure your own parser. The default one is based on [Leasot](https://github.com/pgilad/leasot) and supports a wide range of languages. You can change the list of supported tags by configuring your own version of the built-in parser, for example:
```ts
import {
TodoScmReader,
createTodoParser,
} from '@backstage/plugin-todo-backend';
// ...
const todoReader = TodoScmReader.fromConfig(config, {
logger,
reader,
parser: createTodoParser({
tags: ['TODO', 'FIXME', 'NOTE', 'XXX'],
}),
});
```