Skip removing cache dir if it doesn't exist.

This commit is contained in:
Dillon Kearns 2021-07-31 17:01:56 -07:00
parent 87153f6a71
commit 1d07bff182

View File

@ -90,15 +90,21 @@ async function main() {
function clearHttpAndPortCache() {
const directory = ".elm-pages/http-response-cache";
fs.readdir(directory, (err, files) => {
if (err) throw err;
if (fs.existsSync(directory)) {
fs.readdir(directory, (err, files) => {
if (err) {
throw err;
}
for (const file of files) {
fs.unlink(path.join(directory, file), (err) => {
if (err) throw err;
});
}
});
for (const file of files) {
fs.unlink(path.join(directory, file), (err) => {
if (err) {
throw err;
}
});
}
});
}
}
/**