Describe the bug
I went through the installation instructions (thank you for that by the way), and it looks like I should be able to set a custom cache directory, but it doesn't get used when I pass it in.
To Reproduce
Steps to reproduce the behavior:
Following your Webmention setup:
Step 1. Create a config file and pass a custom directory:
const { defaults } = require("@chrisburnell/eleventy-cache-webmentions")()
// Load .env variables with dotenv
require("dotenv").config()
module.exports = Object.assign(defaults, {
domain: "https://EXAMPLE.COM",
feed: `https://webmention.io/api/mentions.json?domain=EXAMPLE.COM&token=${process.env.WEBMENTION_IO_TOKEN}&per-page=9001`,
key: "links",
directory: "_cache",
})
Step 2: Run the build to fetch webmentions.
Step 3: See that webmentions weren't put in your chosen directory.
Expected behavior
The cache file should be in _cache
instead of .cache
Environment:
- Ubuntu 22.02
- Eleventy Version: V2 Beta (currently, but I've had this issue for a while now)
Additional context
To get around this issue, I'm currently using patch-package to apply a fix postinstall that passes options.directory
into the AssetCache. I pasted my patch file below.
- let asset = new AssetCache(options.uniqueKey)
+ let asset = new AssetCache(options.uniqueKey, options.directory)
asset.ensureDir()
let webmentions = []
I'm not sure if it's really that one line that is the solution, but it seems to fix it for me.