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

Commit 1c35c36

Browse files
committed
fix: use new Netlify build lifecycle events
Signed-off-by: Jonah Snider <[email protected]>
1 parent cab1a6f commit 1c35c36

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/index.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,16 @@ module.exports = {
1313
// Does not do anything if:
1414
// - the file/directory already exists locally
1515
// - the file/directory has not been cached yet
16-
async onGetCache({utils}: {utils: NetlifyUtils}) {
16+
async onPreBuild({utils}: {utils: NetlifyUtils}) {
1717
await utils.cache.restore(joinPaths(__dirname, '.next'), {digest: [joinPaths(__dirname, '.next', 'build-manifest.json')]});
1818
},
1919
// Cache file/directory for future builds.
2020
// Does not do anything if:
2121
// - the file/directory does not exist locally
2222
// - the file/directory is already cached and its contents has not changed
2323
// If this is a directory, this includes children's contents
24-
async onSaveCache({utils}: {utils: NetlifyUtils}) {
24+
// Note that this will cache after the build, even if it fails, which fcould be unwanted behavior
25+
async onPostBuild({utils}: {utils: NetlifyUtils}) {
2526
await utils.cache.save(joinPaths(__dirname, '.next'), {digest: [joinPaths(__dirname, '.next', 'build-manifest.json')]});
2627
}
2728
};

0 commit comments

Comments
 (0)