Skip to content
This repository was archived by the owner on May 10, 2021. It is now read-only.

check existence of dirs before reading them in file tracking logic #150

Merged
merged 1 commit into from
Jan 18, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions lib/helpers/handleFileTracking.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,14 @@ const handleFileTracking = ({ functionsPath, publishPath }) => {

// this callback will run at the end of nextOnNetlify()
const trackNewFiles = () => {
const functionsAfterRun = isConfiguredFunctionsDir
? readdirSync(functionsPath)
: functionsBeforeRun;
const publishAfterRun = isConfiguredPublishDir
? readdirSync(publishPath)
: publishBeforeRun;
const functionsAfterRun =
isConfiguredFunctionsDir && existsSync(functionsPath)
? readdirSync(functionsPath)
: functionsBeforeRun;
const publishAfterRun =
isConfiguredPublishDir && existsSync(publishPath)
? readdirSync(publishPath)
: publishBeforeRun;
const getDifference = (before, after) =>
after.filter((filePath) => !before.includes(filePath));
const newFunctionsFiles = getDifference(
Expand Down