1
mirror of https://github.com/jakejarvis/jarv.is.git synced 2025-06-30 22:46:39 -04:00

extracted & published netlify-plugin-cache on NPM: https://github.com/jakejarvis/netlify-plugin-cache

This commit is contained in:
2020-06-06 10:22:14 -04:00
parent fd06f71df4
commit 04ac760629
5 changed files with 29 additions and 52 deletions

View File

@ -39,13 +39,11 @@
# Cache resoures between builds, see plugins/netlify-plugin-cache/index.js
[[plugins]]
package = "./plugins/netlify-plugin-cache"
package = "netlify-plugin-cache"
[plugins.inputs]
paths = ["resources", "_vendor"]
# [[plugins]]
# package = "netlify-plugin-debug-cache"
# [[plugins]]
# package = "@netlify/plugin-local-install-core"
[[plugins]]
package = "netlify-plugin-debug-cache"
# The most important headers and redirects are specified in the _headers and
# _redirects files generated by Hugo. These are additional custom rules.

View File

@ -51,6 +51,8 @@
"imagemin-svgo": "^8.0.0",
"lint-staged": "^10.2.9",
"markdownlint-cli": "~0.23.1",
"netlify-plugin-cache": "^1.0.0",
"netlify-plugin-debug-cache": "^1.0.3",
"npm-run-all": "^4.1.5",
"postcss": "^7.x",
"postcss-clean": "^1.1.0",

View File

@ -1,30 +0,0 @@
// https://github.com/netlify/build/blob/master/packages/cache-utils/README.md
module.exports = {
// 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)
console.log(`Successfully restored: ${inputs.paths.join(', ')} ... ${files.length} files in total.`)
} else {
console.log(`A cache of ${inputs.paths.join(', ')} doesn't exist (yet).`)
}
},
// 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
status.show({
title: `${files.length} files cached`,
summary: 'These will be restored on the next build! ⚡',
text: `${inputs.paths.join(', ')}`,
})
} else {
console.log(`Failed caching ${inputs.paths.join(', ')}. :(`)
}
},
}

View File

@ -1,5 +0,0 @@
name: netlify-plugin-cache
inputs:
- name: paths
description: Array of files and/or directories to cache between builds.
required: true

View File

@ -1229,9 +1229,9 @@ duplexer3@^0.1.4:
integrity sha1-7gHdHKwO08vH/b6jfcCo8c4ALOI=
electron-to-chromium@^1.3.413:
version "1.3.462"
resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.3.462.tgz#82087404c20ed664963ececab23337ac7a150e21"
integrity sha512-HST/xWLOeA0LGUhxBqvcPDDUGHjB6rn99VBgPWmaHv+zqwXgOaZO5RnRcd5owjRE7nh+z1c0SwcK8qP8o7sofg==
version "1.3.463"
resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.3.463.tgz#bae89d8c2c69b4be32f80221fe49ab5786fab368"
integrity sha512-mAqvpG0efJXV9BGXPVjFdBFiqmawGoIc+c8T2uXYEvbV1/261PaOT0EzZ9dKW4IdGiHXQGSKnnOU86QhJ+5JcA==
emoji-regex@^7.0.1:
version "7.0.3"
@ -1319,7 +1319,7 @@ eslint-plugin-prettier@^3.1.3:
dependencies:
prettier-linter-helpers "^1.0.0"
eslint-scope@^5.0.0:
eslint-scope@^5.1.0:
version "5.1.0"
resolved "https://registry.yarnpkg.com/eslint-scope/-/eslint-scope-5.1.0.tgz#d0f971dfe59c69e0cada684b23d49dbf82600ce5"
integrity sha512-iiGRvtxWqgtx5m8EyQUJihBloE4EnYeGE/bz1wSPwJE6tZuJUtHlhqDM4Xj2ukE8Dyy1+HCZ4hE0fzIVMzb58w==
@ -1340,9 +1340,9 @@ eslint-visitor-keys@^1.1.0, eslint-visitor-keys@^1.2.0:
integrity sha512-WFb4ihckKil6hu3Dp798xdzSfddwKKU3+nGniKF6HfeW6OLd2OUDEPP7TcHtB5+QXOKg2s6B2DaMPE1Nn/kxKQ==
eslint@^7.1.0:
version "7.1.0"
resolved "https://registry.yarnpkg.com/eslint/-/eslint-7.1.0.tgz#d9a1df25e5b7859b0a3d86bb05f0940ab676a851"
integrity sha512-DfS3b8iHMK5z/YLSme8K5cge168I8j8o1uiVmFCgnnjxZQbCGyraF8bMl7Ju4yfBmCuxD7shOF7eqGkcuIHfsA==
version "7.2.0"
resolved "https://registry.yarnpkg.com/eslint/-/eslint-7.2.0.tgz#d41b2e47804b30dbabb093a967fb283d560082e6"
integrity sha512-B3BtEyaDKC5MlfDa2Ha8/D6DsS4fju95zs0hjS3HdGazw+LNayai38A25qMppK37wWGWNYSPOR6oYzlz5MHsRQ==
dependencies:
"@babel/code-frame" "^7.0.0"
ajv "^6.10.0"
@ -1350,10 +1350,10 @@ eslint@^7.1.0:
cross-spawn "^7.0.2"
debug "^4.0.1"
doctrine "^3.0.0"
eslint-scope "^5.0.0"
eslint-scope "^5.1.0"
eslint-utils "^2.0.0"
eslint-visitor-keys "^1.1.0"
espree "^7.0.0"
eslint-visitor-keys "^1.2.0"
espree "^7.1.0"
esquery "^1.2.0"
esutils "^2.0.2"
file-entry-cache "^5.0.1"
@ -1381,7 +1381,7 @@ eslint@^7.1.0:
text-table "^0.2.0"
v8-compile-cache "^2.0.3"
espree@^7.0.0:
espree@^7.1.0:
version "7.1.0"
resolved "https://registry.yarnpkg.com/espree/-/espree-7.1.0.tgz#a9c7f18a752056735bf1ba14cb1b70adc3a5ce1c"
integrity sha512-dcorZSyfmm4WTuTnE5Y7MEN1DyoPYy1ZR783QW1FJoenn7RailyWFsq/UL6ZAAA7uXurN9FIpYyUs3OfiIW+Qw==
@ -2874,7 +2874,7 @@ make-dir@^1.0.0, make-dir@^1.2.0:
dependencies:
pify "^3.0.0"
make-dir@^3.0.0:
make-dir@^3.0.0, make-dir@^3.1.0:
version "3.1.0"
resolved "https://registry.yarnpkg.com/make-dir/-/make-dir-3.1.0.tgz#415e967046b3a7f1d185277d84aa58203726a13f"
integrity sha512-g3FeP20LNwhALb/6Cz6Dd4F2ngze0jz7tbzrD2wAV+o9FeNHe4rL+yK2md0J/fiSf1sa1ADhXqi5+oVwOM/eGw==
@ -3094,6 +3094,18 @@ natural-compare@^1.4.0:
resolved "https://registry.yarnpkg.com/natural-compare/-/natural-compare-1.4.0.tgz#4abebfeed7541f2c27acfb29bdbbd15c8d5ba4f7"
integrity sha1-Sr6/7tdUHywnrPspvbvRXI1bpPc=
netlify-plugin-cache@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/netlify-plugin-cache/-/netlify-plugin-cache-1.0.0.tgz#f5612c3c46b81ea4a1906c86335d6760eea28048"
integrity sha512-rF2lcLH30OGsnFv4jSAt4iD4M0qfknv/3LjTb0OAigNylb4IAK9slrGAZhmK0Cn0AXftzh+4xCiOQ1TfpQb01w==
netlify-plugin-debug-cache@^1.0.3:
version "1.0.3"
resolved "https://registry.yarnpkg.com/netlify-plugin-debug-cache/-/netlify-plugin-debug-cache-1.0.3.tgz#fb90f8b500aa979632bf2b82d865e868e83f67e4"
integrity sha512-0CdIYhw7zdjvpWsaJrT9iLia++NNuB9K9YPzC3FRBwKYEcf+EGlfJzRdhcHPs+5hFrD8JyIWO0058ZgLvjPtDw==
dependencies:
make-dir "^3.1.0"
nice-try@^1.0.4:
version "1.0.5"
resolved "https://registry.yarnpkg.com/nice-try/-/nice-try-1.0.5.tgz#a3378a7696ce7d223e88fc9b764bd7ef1089e366"