diff --git a/package-lock.json b/package-lock.json index b3a9adb..1a5a9bd 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,11 +1,12 @@ { "name": "netlify-plugin-ttl-cache", - "version": "1.0.0", + "version": "1.0.2", "lockfileVersion": 2, "requires": true, "packages": { "": { - "version": "1.0.0", + "name": "netlify-plugin-ttl-cache", + "version": "1.0.2", "license": "MIT", "devDependencies": { "jest": "^27.1.0" diff --git a/src/index.js b/src/index.js index 1b8623d..1a69efa 100644 --- a/src/index.js +++ b/src/index.js @@ -1,4 +1,4 @@ -const { stat, unlink, rmdir } = require("fs").promises; +const { stat, unlink, rm } = require("fs").promises; const { getDaysApart, getDirFilenames, addTrailingSlash } = require("./utils"); const TMP_CACHE_DIR = ".netlify-plugin-ttl-cache"; @@ -38,7 +38,7 @@ const onPostBuild = async ({ utils, inputs }) => { addTrailingSlash(TMP_CACHE_DIR), addTrailingSlash(inputs.path), ]); - await rmdir(TMP_CACHE_DIR, { recursive: true }); + await rm(TMP_CACHE_DIR, { recursive: true }); } // Save new cache diff --git a/src/index.test.js b/src/index.test.js index cc8bf6e..8381640 100644 --- a/src/index.test.js +++ b/src/index.test.js @@ -2,14 +2,14 @@ jest.mock("fs", () => ({ promises: { stat: jest.fn(), unlink: jest.fn(), - rmdir: jest.fn(), + rm: jest.fn(), }, })); jest.mock("./utils", () => ({ ...jest.requireActual("./utils"), getDirFilenames: jest.fn(), })); -const { stat, unlink, rmdir } = require("fs").promises; +const { stat, unlink, rm } = require("fs").promises; const { onPreBuild, onPostBuild } = require("./index"); const { getDirFilenames } = require("./utils"); @@ -148,8 +148,8 @@ describe("on onPostBuild", () => { it("removes old cache directory", async () => { await onPostBuild({ inputs, utils }); - expect(rmdir).toBeCalledTimes(1); - expect(rmdir.mock.calls[0]).toMatchInlineSnapshot(` + expect(rm).toBeCalledTimes(1); + expect(rm.mock.calls[0]).toMatchInlineSnapshot(` Array [ ".netlify-plugin-ttl-cache", Object {