UNPKG

eve

Version:

Filesystem-first framework for durable backend AI agents that run anywhere.

1 lines 765 B
import{stat}from"node:fs/promises";import{dirname,join}from"node:path";async function fileExists(e){try{return(await stat(e)).isFile()}catch(e){if(e instanceof Error&&`code`in e&&e.code===`ENOENT`)return!1;throw e}}async function findClosestDirectoryWithFile(e){let t=e.start;for(;;){let n=join(t,e.directoryName);if(await fileExists(join(n,e.fileName)))return n;let r=dirname(t);if(r===t)return;t=r}}async function findClosestLinkedVercelDirectory(e){return findClosestDirectoryWithFile({start:e,directoryName:`.vercel`,fileName:`project.json`})}async function findClosestVercelOutputDirectory(e){return findClosestDirectoryWithFile({start:e,directoryName:`output`,fileName:`builds.json`})}export{findClosestLinkedVercelDirectory,findClosestVercelOutputDirectory};