config-loader: skip schema collection from packages that don't export package.json

This commit is contained in:
Patrik Oldsberg
2020-11-14 18:03:10 +01:00
parent b6e59e6368
commit eb9e293fce
@@ -53,12 +53,19 @@ export async function collectConfigSchemas(
}
visitedPackages.add(name);
const pkgPath = req.resolve(
`${name}/package.json`,
parentPath && {
paths: [parentPath],
},
);
let pkgPath: string;
try {
pkgPath = req.resolve(
`${name}/package.json`,
parentPath && {
paths: [parentPath],
},
);
} catch {
// We can somewhat safely ignore packages that don't export package.json,
// as they are likely not part of the Backstage ecosystem anyway.
return;
}
const pkg = await fs.readJson(pkgPath);
const depNames = [