diff --git a/src/utils/config-sources.ts b/src/utils/config-sources.ts index f8f4af5..d562b43 100644 --- a/src/utils/config-sources.ts +++ b/src/utils/config-sources.ts @@ -16,16 +16,26 @@ export function stripCommit(version: string): string { async function searchPackageJson(): Promise { const expectedPath = path.join(process.cwd(), 'package.json') - const pkgJson = JSON.parse(await readFile(expectedPath, { encoding: 'utf8' })) - return pkgJson?.engines?.bee + try { + const pkgJson = JSON.parse(await readFile(expectedPath, { encoding: 'utf8' })) + + return pkgJson?.engines?.bee + } catch (e) { + return undefined + } } async function searchBeeFactory(): Promise { const expectedPath = path.join(process.cwd(), '.beefactory.json') - const pkgJson = JSON.parse(await readFile(expectedPath, { encoding: 'utf8' })) - return pkgJson?.version + try { + const pkgJson = JSON.parse(await readFile(expectedPath, { encoding: 'utf8' })) + + return pkgJson?.version + } catch (e) { + return undefined + } } export async function findBeeVersion(): Promise {