netlify-plugin-ttl-cache
netlify-plugin-ttl-cache copied to clipboard
A Netlify plugin for persisting immutable build assets across releases.
`utils.cache` has a [`ttl` option](https://github.com/netlify/build/blob/main/packages/cache-utils/README.md#ttl). Would this work for this plugin?
Closes #1. I also added an `.nvmrc` because my first pass had a huge `package-lock.json` diff due to using a different version of `npm`.
Using binaries like `cp` or `rsync` does not work for builds triggered with Netlify CLI. Those builds are run on the user's machine, which might not have `cp` and/or `rsync`...
`rmdir()` with `recursive: true` [has been deprecated](https://nodejs.org/api/deprecations.html#DEP0147) by Node.js. https://github.com/andyrichardson/netlify-plugin-ttl-cache/blob/54127d8050d92f1335d37c7666c3161aafa82f11/src/index.js#L41 Would it be possible to either: - Use [`rm()` instead with `recusive: true`](https://nodejs.org/api/fs.html#fs_fs_rm_path_options_callback)? This would require setting the `package.json` `engines.node`...
Crawling the publish directory might be slow for some big sites. There might be a few opportunities of optimizing it: - Each `readdir` already performs a `stat` syscall, so doing...
The `path` input specifies the publish directory. At the moment, this defaults to `build`. However, it would be better to default to the site's publish directory, which is [available at...
I noticed using this plugin that there is a [deprecation warning for the usage of fs#rmdir](https://nodejs.org/api/deprecations.html#DEP0147) so thought I would patch it just so something doesn't break in future 😄...
It seems that the plugin logic doesn't seem to work anymore. I have this setup: ``` [[plugins]] package = "netlify-plugin-ttl-cache" [plugins.inputs] path = "dist/spa" ttl = 100 # days ```...