From 79be2abafe0ccb73ae6ca6aa125ef86c86a82d97 Mon Sep 17 00:00:00 2001 From: Jake Jarvis Date: Sat, 6 Jun 2020 16:46:32 -0400 Subject: [PATCH] update netlify-plugin-cache to v1.0.2 [skip ci] --- netlify.toml | 5 ++-- package.json | 4 +-- plugins/netlify-plugin-cache/README.md | 35 +++++++++++------------ plugins/netlify-plugin-cache/package.json | 2 +- yarn.lock | 10 +++---- 5 files changed, 28 insertions(+), 28 deletions(-) diff --git a/netlify.toml b/netlify.toml index 1e6567d9..30a06999 100644 --- a/netlify.toml +++ b/netlify.toml @@ -37,11 +37,12 @@ publish = "public" autoLaunch = false -# Cache resoures between builds, see plugins/netlify-plugin-cache/index.js +# Cache resoures between builds: +# https://github.com/jakejarvis/netlify-plugin-cache [[plugins]] package = "@netlify/plugin-local-install-core" [[plugins]] - package = "netlify-plugin-cache" + package = "./plugins/netlify-plugin-cache" [plugins.inputs] paths = ["resources", "_vendor"] [[plugins]] diff --git a/package.json b/package.json index a3c98a49..5246cb3b 100644 --- a/package.json +++ b/package.json @@ -51,8 +51,8 @@ "imagemin-svgo": "^8.0.0", "lint-staged": "^10.2.9", "markdownlint-cli": "~0.23.1", - "netlify-plugin-cache": "^1.0.1", - "netlify-plugin-debug-cache": "^1.0.3", + "netlify-plugin-cache": "*", + "netlify-plugin-debug-cache": "*", "npm-run-all": "^4.1.5", "postcss": "^7.x", "postcss-clean": "^1.1.0", diff --git a/plugins/netlify-plugin-cache/README.md b/plugins/netlify-plugin-cache/README.md index d004fa01..69ce4bc7 100644 --- a/plugins/netlify-plugin-cache/README.md +++ b/plugins/netlify-plugin-cache/README.md @@ -1,49 +1,48 @@ -# Netlify Plugin: Custom Cache +# ⚡ Netlify Plugin: Custom Cache [![npm](https://img.shields.io/npm/v/netlify-plugin-cache?logo=npm&color=red)](https://www.npmjs.com/package/netlify-plugin-cache) ![CI](https://github.com/jakejarvis/netlify-plugin-cache/workflows/CI/badge.svg) -[![npm](https://img.shields.io/npm/v/netlify-plugin-cache?logo=npm&color=red)](https://www.npmjs.com/package/netlify-plugin-cache) +A generic cache plugin for saving and restoring files and/or folders between Netlify builds for impressive speed improvements. Worry less about running out of build minutes! ⏰ -A generic cache plugin for saving and restoring files and/or folders between Netlify builds for impressive speed improvements. Worry less about running out of build minutes! ⚡ +Essentially, this plugin is a pretty wrapper around [Netlify's native cache utility](https://github.com/netlify/build/blob/master/packages/cache-utils/README.md) — it isn't tied to any specific static site generator (on purpose). -In other words, this plugin is a pretty wrapper around [Netlify's native cache utility](https://github.com/netlify/build/blob/master/packages/cache-utils/README.md -) — it isn't tied to any specific static site generator (on purpose). +## 💿 Install -## Install - -Add the following to your `netlify.toml` configuration: +Add the following lines to your `netlify.toml`: ```toml [[plugins]] package = "netlify-plugin-cache" [plugins.inputs] + # Optional (but highly recommended). Defaults to [".cache"]. paths = ["resources", "_vendor", "folder/file.md"] ``` -This plugin only takes one input named `paths`, an array of files and/or directories relative to your project's root. These files/directories are restored before a build and saved in cache after a build **if it is successful**. +This plugin only takes one input named `paths`: an array of files and/or directories relative to your project's root. These files/directories are restored before a build and saved in cache after a build **if it is successful**. -**🚨 Important:** `paths` defaults to `[".cache"]`, but it's **highly recommended** you set this yourself based on the tools you're using. See examples below. +**🚨 Important:** `paths` defaults to `[".cache"]`, but it's **highly recommended** you set this yourself based on the tool(s) you're using to generate your site. See examples below. Read more about plugin configuration at [the official Netlify Plugin docs](https://docs.netlify.com/configure-builds/build-plugins/#install-a-plugin). -## Usage examples +## 👩‍💻 Usage -- **Hugo:** Caching the `resources` directory can speed up your build greatly if you [process](https://gohugo.io/content-management/image-processing/) a lot of images via Hugo pipes. You can also cache the `public` directory to avoid completely rebuilding the entire site on each deploy. [More info here.](https://gohugo.io/getting-started/directory-structure/#directory-structure-explained) +- **Hugo:** Caching the `resources` directory can speed up your build greatly if you [process](https://gohugo.io/content-management/image-processing/) a lot of images, or compile SASS/SCSS via Hugo pipes. You can also cache the `public` directory to avoid completely rebuilding the entire site on each deploy. [More info here.](https://gohugo.io/getting-started/directory-structure/#directory-structure-explained) - **Gatsby:** By default, the `.cache` directory holds persistent data between builds. You can also cache the `dist` directory to avoid completely rebuilding the entire site on each deploy. [More info here.](https://www.gatsbyjs.org/docs/build-caching/) +- **Jekyll:** A caching API was added as of v4. The notoriously slow SSG can become (relatively) faster by caching the `.jekyll-cache` directory. [More info here.](https://jekyllrb.com/tutorials/cache-api/) - **Next.js:** The `.next` directory holds the build output. [More info here.](https://nextjs.org/docs/api-reference/next.config.js/setting-a-custom-build-directory) -- **Anything else:** This is the reason I kept this plugin as generic as possible! Research the caching behavior of your static site generator (and how to customize it if necessary). Feel free to make a PR and add it here as another example, too! +- **Anything else:** This is the reason I kept this plugin as generic as possible! Research the caching behavior of your static site generator (and how to customize it if necessary). Feel free to open a PR and list it here as well! -## Debugging +## 🐛 Debugging This plugin doesn't provide a way to output a list of files that were cached or restored, because Netlify already provides an official plugin named [`netlify-plugin-debug-cache`](https://github.com/netlify-labs/netlify-plugin-debug-cache) to do exactly that. No need to re-invent the wheel! -You can add their debug plugin **after** this plugin in your `netlify.toml`. (And yes, you need a `[[plugins]]` line for *each* plugin you add.) +You can add the debug plugin **after** this plugin in your `netlify.toml`. (And yes, you need a `[[plugins]]` line for _each_ plugin you add.) ```toml [[plugins]] package = "netlify-plugin-debug-cache" ``` -The plugin will generate a file named `cache-output.json` at the root of your project's publish directory. [See an example file](https://gist.github.com/jakejarvis/dff606289e8b5d6be42d317e425bbee6#file-cache-output-json) or [learn more about this plugin](https://github.com/netlify-labs/netlify-plugin-debug-cache). +The debug plugin will generate a file named `cache-output.json` at the root of your project's publish directory. [See an example file](https://infallible-wing-581e78.netlify.app/cache-output.json) or [learn more about this plugin](https://github.com/netlify-labs/netlify-plugin-debug-cache). -## Licenses +## 📜 License -This project is distributed under the [MIT License](LICENSE). +This project is distributed under the [MIT license](LICENSE). diff --git a/plugins/netlify-plugin-cache/package.json b/plugins/netlify-plugin-cache/package.json index 8802d0cd..ba5aae62 100644 --- a/plugins/netlify-plugin-cache/package.json +++ b/plugins/netlify-plugin-cache/package.json @@ -1,6 +1,6 @@ { "name": "netlify-plugin-cache", - "version": "1.0.1", + "version": "1.0.2", "description": "Generic cache plugin for saving and restoring files and/or folders between Netlify builds", "author": "Jake Jarvis ", "license": "MIT", diff --git a/yarn.lock b/yarn.lock index 06d3f462..e681e8af 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3094,12 +3094,12 @@ 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.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/netlify-plugin-cache/-/netlify-plugin-cache-1.0.1.tgz#65c7a722938d973b9c56202d2dcbbd3d187b8d2c" - integrity sha512-IAHI0K5lp/PP35UaOWjRRsFFWMiHphiTFlFGHj2Vt0r9a9qwxT54PxJqFCunxKtPxynQ3E7/Ybi2cwLd4lbb/g== +netlify-plugin-cache@*: + version "1.0.2" + resolved "https://registry.yarnpkg.com/netlify-plugin-cache/-/netlify-plugin-cache-1.0.2.tgz#7d0759af2228d7360c461377334f28b10adb7030" + integrity sha512-0abQlUdGX4cRtQiyP+6HLYlnxPZDe+dqckEOL6a4I4sTd2M0ZwOX6iPvxig6eHH26NDLPOXx7ugF6aQ5x8WXAg== -netlify-plugin-debug-cache@^1.0.3: +netlify-plugin-debug-cache@*: 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==