Skip to content

Commit

Permalink
feat: export local & global cache directories
Browse files Browse the repository at this point in the history
  • Loading branch information
bgenia committed Nov 29, 2023
1 parent 8c93723 commit 573ef49
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/cache/cache.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,14 @@ const cacheOptions = {
const AUTH_TTL_SEX = 60 * 60 * 10 // 10h
const PERSISTENT_TTL_SEX = 60 * 60 * 48 // 48h

const cacheDirBase = cacheOptions.local ? process.cwd() : homedir()
const CACHE_BASENAME = ".s21/cache"

export const cacheDirectory = resolve(cacheDirBase, ".s21/cache")
export const globalCacheDirectory = resolve(homedir(), CACHE_BASENAME)
export const localCacheDirectory = resolve(process.cwd(), CACHE_BASENAME)

export const cacheDirectory = cacheOptions.local
? localCacheDirectory
: globalCacheDirectory

await mkdir(cacheDirectory, {
recursive: true,
Expand Down

0 comments on commit 573ef49

Please sign in to comment.