Skip to content

Commit

Permalink
fixup! fix: Listen for file changes in watch mode in longest common d…
Browse files Browse the repository at this point in the history
…irectory
  • Loading branch information
milesrichardson committed Apr 3, 2023
1 parent ff3e0a0 commit d3bf8f4
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions packages/graphql-codegen-cli/src/utils/watcher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -205,11 +205,11 @@ const longestCommonPrefix = (splitPaths: string[][]): string[] => {
return [];
}

// Loop through the letters of the first word
// Loop through the segments of the first path
for (let i = 0; i <= splitPaths[0].length; i++) {
// Check if this character is present in the same position of every string
// Check if this path segment is present in the same position of every path
if (!splitPaths.every(string => string[i] === splitPaths[0][i])) {
// If not, return the string up to and including the previous character
// If not, return the path segments up to and including the previous segment
return splitPaths[0].slice(0, i);
}
}
Expand Down

0 comments on commit d3bf8f4

Please sign in to comment.