mirror of
https://github.com/jakejarvis/jarv.is.git
synced 2026-09-10 19:25:34 -04:00
bump netlify-plugin-cache
This commit is contained in:
@@ -1,7 +1,11 @@
|
||||
// Netlify Plugin: netlify-plugin-cache
|
||||
// https://github.com/jakejarvis/netlify-plugin-cache
|
||||
//
|
||||
// This plugin is essentially a wrapper around Netlify's native `cache-utils`:
|
||||
// https://github.com/netlify/build/blob/master/packages/cache-utils/README.md
|
||||
|
||||
module.exports = {
|
||||
// try to restore cache before build begins, if it exists
|
||||
// Try to restore cache before build begins, if it exists
|
||||
onPreBuild: async ({ utils: { cache }, inputs }) => {
|
||||
if (await cache.restore(inputs.paths)) {
|
||||
const files = await cache.list(inputs.paths)
|
||||
@@ -11,23 +15,23 @@ module.exports = {
|
||||
}
|
||||
},
|
||||
|
||||
// only save/update cache if build was successful
|
||||
// Only save/update cache if build was successful
|
||||
onSuccess: async ({ utils: { cache, status }, inputs }) => {
|
||||
if (await cache.save(inputs.paths)) {
|
||||
const files = await cache.list(inputs.paths)
|
||||
console.log(`Successfully cached: ${inputs.paths.join(', ')} ... ${files.length} files in total.`)
|
||||
|
||||
// show success & more detail in deploy summary
|
||||
// Show success & more detail in deploy summary
|
||||
status.show({
|
||||
title: `${files.length} files cached`,
|
||||
summary: 'These will be restored on the next build! ⚡',
|
||||
text: `${inputs.paths.join(', ')}`,
|
||||
text: `${inputs.paths.join(', ')}`
|
||||
})
|
||||
} else {
|
||||
// this probably happened because the default `paths` is set, so provide instructions to fix
|
||||
// This probably happened because the default `paths` is set, so provide instructions to fix
|
||||
console.log(`Attempted to cache: ${inputs.paths.join(', ')} ... but failed. :(`)
|
||||
console.log(`Try setting the 'paths' input appropriately in your netlify.toml or netlify.yml.`)
|
||||
console.log(`More details: https://jrvs.io/netlify-cache-usage`)
|
||||
console.log('Try setting the \'paths\' input appropriately in your netlify.toml configuration.')
|
||||
console.log('More details: https://jrvs.io/netlify-cache-usage')
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,18 +1,31 @@
|
||||
{
|
||||
"name": "netlify-plugin-cache",
|
||||
"version": "1.0.2",
|
||||
"version": "1.0.3",
|
||||
"description": "Generic cache plugin for saving and restoring files and/or folders between Netlify builds",
|
||||
"author": "Jake Jarvis <jake@jarv.is>",
|
||||
"license": "MIT",
|
||||
"main": "index.js",
|
||||
"author": {
|
||||
"name": "Jake Jarvis",
|
||||
"email": "jake@jarv.is",
|
||||
"url": "http://jarv.is/"
|
||||
},
|
||||
"homepage": "https://github.com/jakejarvis/netlify-plugin-cache#readme",
|
||||
"bugs": "https://github.com/jakejarvis/netlify-plugin-cache/issues",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/jakejarvis/netlify-plugin-cache.git"
|
||||
},
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
"build": "netlify build",
|
||||
"test": "xo"
|
||||
},
|
||||
"dependencies": {},
|
||||
"devDependencies": {
|
||||
"netlify-cli": "*",
|
||||
"xo": "~0.32.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=10.18"
|
||||
},
|
||||
"keywords": [
|
||||
"netlify",
|
||||
@@ -21,5 +34,12 @@
|
||||
"ci",
|
||||
"build",
|
||||
"plugin"
|
||||
]
|
||||
],
|
||||
"xo": {
|
||||
"semicolon": false,
|
||||
"space": 2,
|
||||
"rules": {
|
||||
"object-curly-spacing": 0
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user