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;