Merge pull request #5673 from SDA-SE/feat/fix-file-glob

Resolve the target for glob file locations correctly
This commit is contained in:
Fredrik Adelöw
2021-05-17 21:05:49 +02:00
committed by GitHub
3 changed files with 17 additions and 1 deletions
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/plugin-catalog-backend': patch
---
Resolve the `target` for glob `file` locations correctly
@@ -79,6 +79,14 @@ describe('FileReaderProcessor', () => {
expect(emit).toBeCalledTimes(2);
expect(emit.mock.calls[0][0].entity).toEqual({ kind: 'Component' });
expect(emit.mock.calls[0][0].location).toEqual({
type: 'file',
target: expect.stringMatching(/^[^*]*$/),
});
expect(emit.mock.calls[1][0].entity).toEqual({ kind: 'API' });
expect(emit.mock.calls[1][0].location).toEqual({
type: 'file',
target: expect.stringMatching(/^[^*]*$/),
});
});
});
@@ -41,7 +41,10 @@ export class FileReaderProcessor implements CatalogProcessor {
for (const fileMatch of fileMatches) {
const data = await fs.readFile(fileMatch);
for (const parseResult of parseEntityYaml(data, location)) {
for (const parseResult of parseEntityYaml(data, {
type: 'file',
target: fileMatch,
})) {
emit(parseResult);
}
}