diff --git a/.eslintignore b/.eslintignore deleted file mode 100644 index 16873f69..00000000 --- a/.eslintignore +++ /dev/null @@ -1 +0,0 @@ -plugins/ diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index 7ee25328..00000000 --- a/.gitattributes +++ /dev/null @@ -1,2 +0,0 @@ -# Set default behavior to automatically normalize line endings. -* text=auto eol=lf diff --git a/.prettierignore b/.prettierignore index 8909a0d6..8e109819 100644 --- a/.prettierignore +++ b/.prettierignore @@ -9,9 +9,6 @@ builds/ resources/ _vendor/ -# Netlify plugins -plugins/ - # dotfiles/config .* postcss.config.js diff --git a/config.toml b/config.toml index 35559289..2c7ee4fe 100644 --- a/config.toml +++ b/config.toml @@ -28,17 +28,17 @@ disableAliases = true description = "Hi there! I'm a frontend web developer based in Boston, Massachusetts specializing in the JAMstack, modern JavaScript frameworks, and progressive web apps." image = "img/logo.png" # relative to assetDir root mainSection = "notes" # content that appears in feeds - [params.social] - githubRepo = "jakejarvis/jarv.is" # user/repo - webmentionIO = "jarv.is" # webmention.io username - facebookAppID = 3357248167622283 + [params.theme] + maxWidth = 940 # px + defaultTheme = "light" # light or dark? [params.license] name = "CC-BY-4.0" nameLong = "Creative Commons Attribution 4.0 International" copyrightFirstYear = 2001 - [params.theme] - maxWidth = 940 # px - defaultTheme = "light" # light or dark? + [params.social] + githubRepo = "jakejarvis/jarv.is" # user/repo + webmentionIO = "jarv.is" # webmention.io username + facebookAppID = 3357248167622283 [author] name = "Jake Jarvis" @@ -90,7 +90,7 @@ disableAliases = true weight = -70 [outputs] - home = ["HTML", "RSS", "ATOM", "ALGOLIA", "MANIFEST", "REDIRECTS", "HEADERS"] + home = ["HTML", "RSS", "ATOM", "MANIFEST", "REDIRECTS", "HEADERS"] section = ["HTML"] page = ["HTML", "AMP"] @@ -138,7 +138,7 @@ disableAliases = true [mediaTypes."application/manifest+json"] suffixes = ["webmanifest"] [mediaTypes."text/netlify"] - delimiter = "" # no extension for _headers & _redirects files + delimiter = "" # no dot/extension for _headers & _redirects files [sitemap] filename = "sitemap.xml" diff --git a/netlify.toml b/netlify.toml index 9353ee18..5f7f57a3 100644 --- a/netlify.toml +++ b/netlify.toml @@ -41,13 +41,11 @@ # Cache resoures between builds: # https://github.com/jakejarvis/netlify-plugin-cache [[plugins]] - package = "@netlify/plugin-local-install-core" -[[plugins]] - package = "./plugins/netlify-plugin-cache" + package = "netlify-plugin-cache" [plugins.inputs] paths = ["resources", "public", "_vendor"] -[[plugins]] - package = "netlify-plugin-debug-cache" +# [[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. diff --git a/package.json b/package.json index 0ca49d0f..19764ab7 100644 --- a/package.json +++ b/package.json @@ -14,7 +14,7 @@ "url": "git+https://github.com/jakejarvis/jarv.is.git" }, "scripts": { - "clean": "hugo mod clean && rimraf public/ resources/ builds/ _vendor/ .netlify/functions/ $TMPDIR/hugo_cache/ || true", + "clean": "hugo mod clean && rimraf public/ resources/ builds/ _vendor/ .netlify/{cache,functions}/ $TMPDIR/hugo_cache/ || true", "build": "run-s build:hugo build:functions minify", "build:hugo": "hugo --gc --cleanDestinationDir --verbose", "build:functions": "netlify-lambda build functions", @@ -30,9 +30,7 @@ "lint:scss": "stylelint 'assets/sass/**/*.scss' --syntax scss", "lint:js": "eslint 'assets/js/**/*.js' 'functions/**/*.js'", "lint:md": "markdownlint 'content/**/*.md'", - "lint:prettier": "prettier --check .", - "index": "run-s clean build:hugo index:**", - "index:algolia": "npx atomic-algolia" + "lint:prettier": "prettier --check ." }, "dependencies": { "normalize.css": "8.0.1", diff --git a/plugins/netlify-plugin-cache/LICENSE b/plugins/netlify-plugin-cache/LICENSE deleted file mode 100644 index 57b6e477..00000000 --- a/plugins/netlify-plugin-cache/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -MIT License - -Copyright (c) 2020 Jake Jarvis - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/plugins/netlify-plugin-cache/README.md b/plugins/netlify-plugin-cache/README.md deleted file mode 100644 index 69ce4bc7..00000000 --- a/plugins/netlify-plugin-cache/README.md +++ /dev/null @@ -1,48 +0,0 @@ -# ⚑ 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) - -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). - -## πŸ’Ώ Install - -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**. - -**🚨 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 - -- **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 open a PR and list it here as well! - -## πŸ› 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 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 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). - -## πŸ“œ License - -This project is distributed under the [MIT license](LICENSE). diff --git a/plugins/netlify-plugin-cache/index.js b/plugins/netlify-plugin-cache/index.js deleted file mode 100644 index 437e0d9c..00000000 --- a/plugins/netlify-plugin-cache/index.js +++ /dev/null @@ -1,37 +0,0 @@ -// 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 - 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 { - // 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 configuration.') - console.log('More details: https://jrvs.io/netlify-cache-usage') - } - } -} diff --git a/plugins/netlify-plugin-cache/manifest.yml b/plugins/netlify-plugin-cache/manifest.yml deleted file mode 100644 index ee47a0be..00000000 --- a/plugins/netlify-plugin-cache/manifest.yml +++ /dev/null @@ -1,5 +0,0 @@ -name: netlify-plugin-cache -inputs: -- name: paths - description: Array of files and/or directories to cache between builds. - default: [".cache"] diff --git a/plugins/netlify-plugin-cache/package.json b/plugins/netlify-plugin-cache/package.json deleted file mode 100644 index bd712a8f..00000000 --- a/plugins/netlify-plugin-cache/package.json +++ /dev/null @@ -1,45 +0,0 @@ -{ - "name": "netlify-plugin-cache", - "version": "1.0.3", - "description": "Generic cache plugin for saving and restoring files and/or folders between Netlify builds", - "license": "MIT", - "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": { - "build": "netlify build", - "test": "xo" - }, - "dependencies": {}, - "devDependencies": { - "netlify-cli": "*", - "xo": "~0.32.0" - }, - "engines": { - "node": ">=10.18" - }, - "keywords": [ - "netlify", - "netlify-plugin", - "cache", - "ci", - "build", - "plugin" - ], - "xo": { - "semicolon": false, - "space": 2, - "rules": { - "object-curly-spacing": 0 - } - } -}