mirror of
https://github.com/logos-storage/codex-factory.git
synced 2026-01-08 07:53:06 +00:00
fix: proper error handling when conf does not exists (#106)
This commit is contained in:
parent
97ad7c80d9
commit
c1a1d3a885
@ -16,16 +16,26 @@ export function stripCommit(version: string): string {
|
|||||||
|
|
||||||
async function searchPackageJson(): Promise<string | undefined> {
|
async function searchPackageJson(): Promise<string | undefined> {
|
||||||
const expectedPath = path.join(process.cwd(), 'package.json')
|
const expectedPath = path.join(process.cwd(), 'package.json')
|
||||||
|
|
||||||
|
try {
|
||||||
const pkgJson = JSON.parse(await readFile(expectedPath, { encoding: 'utf8' }))
|
const pkgJson = JSON.parse(await readFile(expectedPath, { encoding: 'utf8' }))
|
||||||
|
|
||||||
return pkgJson?.engines?.bee
|
return pkgJson?.engines?.bee
|
||||||
|
} catch (e) {
|
||||||
|
return undefined
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async function searchBeeFactory(): Promise<string | undefined> {
|
async function searchBeeFactory(): Promise<string | undefined> {
|
||||||
const expectedPath = path.join(process.cwd(), '.beefactory.json')
|
const expectedPath = path.join(process.cwd(), '.beefactory.json')
|
||||||
|
|
||||||
|
try {
|
||||||
const pkgJson = JSON.parse(await readFile(expectedPath, { encoding: 'utf8' }))
|
const pkgJson = JSON.parse(await readFile(expectedPath, { encoding: 'utf8' }))
|
||||||
|
|
||||||
return pkgJson?.version
|
return pkgJson?.version
|
||||||
|
} catch (e) {
|
||||||
|
return undefined
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function findBeeVersion(): Promise<string> {
|
export async function findBeeVersion(): Promise<string> {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user