@@ -20,14 +20,14 @@ interface Options {
2020 /** Recursive traversal depth */
2121 depth : number ;
2222 /** Bypass cached data and fetch files anyway */
23- bypassCache : boolean ;
23+ noCache : boolean ;
2424}
2525
2626const defaulOptions : Options = {
2727 path : '' ,
2828 branch : 'master' ,
2929 depth : 1 ,
30- bypassCache : false ,
30+ noCache : false ,
3131} ;
3232
3333/**
@@ -39,21 +39,26 @@ export async function getFiles(
3939 name : string ,
4040 options : Partial < Options > ,
4141) {
42- const cache = await _persistentCachePromise ;
4342 const opts = { ...defaulOptions , ...options } ;
43+
44+ if ( opts . noCache ) {
45+ return await getFilesList ( owner , name , opts ) ;
46+ }
47+
48+ const cache = await _persistentCachePromise ;
4449 const cacheKey = getCacheKey ( owner , name , opts ) ;
4550
4651 // If cache has fresh data, return it.
4752 let cached = cache . get ( cacheKey , false ) ;
48- if ( cached && ! opts . bypassCache ) {
53+ if ( cached ) {
4954 return cached . files ;
5055 }
5156
5257 // Find date of latest commit and compare it with stale cache data.
5358 // Pick from "stale" cache as there is no new commit.
5459 cached = cache . get ( cacheKey , true ) ;
5560 const lastCommitAt = await getLatestCommitDate ( owner , name , opts ) ;
56- if ( cached && cached . lastCommitAt === lastCommitAt && ! opts . bypassCache ) {
61+ if ( cached && cached . lastCommitAt === lastCommitAt ) {
5762 return cached . files ;
5863 }
5964
0 commit comments