Skip to content

Commit

Permalink
fix: don't fail is cache is empty
Browse files Browse the repository at this point in the history
There are some scenarios where it is not possible to get a cache directory, but the command can work
  • Loading branch information
Kikobeats committed Jan 21, 2025
1 parent 5d2ce4e commit ad58967
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/cache.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,15 @@ import findCacheDirectory from 'find-cache-dir'
import { existsSync } from 'fs'
import path from 'path'

import { ErrorLinkProject } from './error.js'

export const createCache = () => {
const cacheDir = findCacheDirectory({ name: 'vercel-open' })
if (cacheDir === undefined) throw ErrorLinkProject()

if (cacheDir === undefined) {
return {
read: async () => {},
write: async () => {}
}
}

const cachePath = path.resolve(cacheDir, 'cache.json')

Expand Down

0 comments on commit ad58967

Please sign in to comment.