Skip to content

Commit b8668ae

Browse files
authored
Get dot files for local cache storage (#551)
1 parent ba0e283 commit b8668ae

File tree

3 files changed

+30
-0
lines changed

3 files changed

+30
-0
lines changed
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"changes": [
3+
{
4+
"type": "patch",
5+
"comment": "Make sure that the backfill cache copies files beginning with a . over during fetch calls",
6+
"packageName": "backfill-cache",
7+
"email": "1581488+christiango@users.noreply.github.com",
8+
"dependentChangeType": "patch"
9+
}
10+
]
11+
}

packages/cache/src/LocalCacheStorage.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ export class LocalCacheStorage extends CacheStorage {
2828

2929
const files = await globby(`**/*`, {
3030
cwd: localCacheFolder,
31+
dot: true,
3132
});
3233

3334
await Promise.all(

packages/cache/src/__tests__/LocalCacheStorage.test.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,15 @@ async function putInCache({
118118

119119
expectPathExists(path.join(fixtureLocation, pathToCheck), expectSuccess);
120120
});
121+
122+
if (expectSuccess) {
123+
for (const f of filesToCache) {
124+
fs.removeSync(path.join(fixtureLocation, f));
125+
expectPathExists(path.join(fixtureLocation, f), false);
126+
await cacheStorage.fetch(hash);
127+
expectPathExists(path.join(fixtureLocation, f), true);
128+
}
129+
}
121130
}
122131

123132
describe("LocalCacheStorage", () => {
@@ -197,5 +206,14 @@ describe("LocalCacheStorage", () => {
197206
filesToCache: ["lib/azerty"],
198207
});
199208
});
209+
210+
it("will persist files that are in a folder with a . in them", async () => {
211+
await putInCache({
212+
fixtureName: "basic",
213+
hash: "46df1a257dfbde62b1e284f6382b20a49506f029",
214+
outputGlob: [".react-router/**"],
215+
filesToCache: [".react-router/types/route.d.ts"],
216+
});
217+
});
200218
});
201219
});

0 commit comments

Comments
 (0)