refactor: have stage-ui dedicated (#11)
* tmp commit * now it works * fix: various of type and import issues * refactor: move test * refactor: rename with stage- prefix * refactor: all monorepo packages * refactor: fix all build * refactor: fix missing dep * fix: remove unnecessary deps * fix: netlify publish * fix: hf space deploy --------- Co-authored-by: LemonNeko <chheese048@gmail.com>
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
import { stat } from 'node:fs/promises'
|
||||
|
||||
export async function exists(path: string) {
|
||||
try {
|
||||
await stat(path)
|
||||
return true
|
||||
}
|
||||
catch (error) {
|
||||
if (isENOENTError(error))
|
||||
return false
|
||||
|
||||
throw error
|
||||
}
|
||||
}
|
||||
|
||||
export function isENOENTError(error: unknown): boolean {
|
||||
if (!(error instanceof Error))
|
||||
return false
|
||||
if (!('code' in error))
|
||||
return false
|
||||
if (error.code !== 'ENOENT')
|
||||
return false
|
||||
|
||||
return true
|
||||
}
|
||||
Reference in New Issue
Block a user