diff --git a/helpers/functions/fileHelpers.ts b/helpers/functions/fileHelpers.ts index 15eb0bd..16f148f 100644 --- a/helpers/functions/fileHelpers.ts +++ b/helpers/functions/fileHelpers.ts @@ -28,6 +28,13 @@ export const updateUsersList = async (usersList: BorgWarehouseUser[]): Promise => { + try { + await fs.access(repoFilePath); + } catch { + console.log('repo.json not found, creating a new one.'); + await fs.writeFile(repoFilePath, JSON.stringify([])); + } + try { const fileContent = await fs.readFile(repoFilePath, 'utf8'); return JSON.parse(fileContent) || [];