Skip to content
This repository was archived by the owner on Jan 2, 2022. It is now read-only.

Commit cab1a6f

Browse files
committed
feat: use path module for generating paths
Signed-off-by: Jonah Snider <[email protected]>
1 parent 3e4601b commit cab1a6f

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/index.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import {join as joinPaths} from 'path';
2+
13
interface NetlifyUtils {
24
cache: {
35
restore(path: string, options: {digest: string[]}): Promise<any>;
@@ -12,14 +14,14 @@ module.exports = {
1214
// - the file/directory already exists locally
1315
// - the file/directory has not been cached yet
1416
async onGetCache({utils}: {utils: NetlifyUtils}) {
15-
await utils.cache.restore('./.next', {digest: ['./.next/build-manifest.json']});
17+
await utils.cache.restore(joinPaths(__dirname, '.next'), {digest: [joinPaths(__dirname, '.next', 'build-manifest.json')]});
1618
},
1719
// Cache file/directory for future builds.
1820
// Does not do anything if:
1921
// - the file/directory does not exist locally
2022
// - the file/directory is already cached and its contents has not changed
2123
// If this is a directory, this includes children's contents
2224
async onSaveCache({utils}: {utils: NetlifyUtils}) {
23-
await utils.cache.save('./.next', {digest: ['./.next/build-manifest.json']});
25+
await utils.cache.save(joinPaths(__dirname, '.next'), {digest: [joinPaths(__dirname, '.next', 'build-manifest.json')]});
2426
}
2527
};

0 commit comments

Comments
 (0)