netlify-purge-cloudflare-on-deploy
Advanced tools
Comparing version 1.1.0 to 1.2.0
21
index.js
@@ -19,9 +19,7 @@ const fetch = require('node-fetch'); | ||
module.exports = { | ||
async onEnd({ | ||
utils: { | ||
build: { failPlugin, failBuild }, | ||
}, | ||
}) { | ||
// Since calling utils.build.failBuild will not actually fail the build in onPreBuild, moved the conditions in onPreBuild. | ||
onPostBuild({ | ||
utils: { | ||
build: { failBuild }, | ||
}, | ||
}) { | ||
if( authMethod === 'na' ) { | ||
@@ -40,3 +38,8 @@ return failBuild( | ||
} | ||
}, | ||
async onSuccess({ | ||
utils: { | ||
build: { failPlugin }, | ||
}, | ||
}) { | ||
console.log('Preparing to trigger Cloudflare cache purge'); | ||
@@ -77,5 +80,5 @@ let baseUrl = `https://api.cloudflare.com/client/v4/zones/${CLOUDFLARE_ZONE_ID}/purge_cache`; | ||
} catch (error) { | ||
return failBuild('Cloudflare cache purge failed', { error }); | ||
return failPlugin('Cloudflare cache purge failed', { error }); | ||
} | ||
}, | ||
}; |
{ | ||
"name": "netlify-purge-cloudflare-on-deploy", | ||
"version": "1.1.0", | ||
"version": "1.2.0", | ||
"description": "Automatically purge Cloudflare cache on Netlify deploy.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
74
6737