From 8f88749beccb0b1f78e1b0d716cab9df4d28914a Mon Sep 17 00:00:00 2001 From: Lindsay Levine Date: Wed, 18 Nov 2020 05:53:32 -0500 Subject: [PATCH] fix: dont empty publish/function paths unless theyre default --- lib/steps/prepareFolders.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/steps/prepareFolders.js b/lib/steps/prepareFolders.js index 4cd75ce..e2dbd22 100644 --- a/lib/steps/prepareFolders.js +++ b/lib/steps/prepareFolders.js @@ -1,5 +1,6 @@ const { emptyDirSync } = require("fs-extra"); const { logTitle, log } = require("../helpers/logger"); +const { NETLIFY_PUBLISH_PATH, NETLIFY_FUNCTIONS_PATH } = require("../config"); // Empty existing publish and functions folders const prepareFolders = ({ functionsPath, publishPath }) => { @@ -8,8 +9,8 @@ const prepareFolders = ({ functionsPath, publishPath }) => { log(" ", "Publish directory: ", publishPath); log(" ", "Make sure these are set in your netlify.toml file."); - emptyDirSync(publishPath); - emptyDirSync(functionsPath); + if (publishPath === NETLIFY_PUBLISH_PATH) emptyDirSync(publishPath); + if (functionsPath === NETLIFY_FUNCTIONS_PATH) emptyDirSync(functionsPath); }; module.exports = prepareFolders;