Skip to content

Commit

Permalink
fix(core): only perform pattern matching if file input doesn't exist (#…
Browse files Browse the repository at this point in the history
…15640)

(cherry picked from commit 5add52b)
  • Loading branch information
ZackDeRose authored and FrozenPandaz committed Mar 15, 2023
1 parent 336ed03 commit f32eee9
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions packages/nx/src/hasher/hasher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -459,12 +459,18 @@ class TaskHasher {
if (!this.filesetHashes[mapKey]) {
this.filesetHashes[mapKey] = new Promise(async (res) => {
const parts = [];
this.projectGraph.allWorkspaceFiles
.filter((f) => minimatch(f.file, withoutWorkspaceRoot))
.forEach((f) => {
parts.push(f.hash);
});

const matchingFile = this.projectGraph.allWorkspaceFiles.find(
(t) => t.file === withoutWorkspaceRoot
);
if (matchingFile) {
parts.push(matchingFile.hash);
} else {
this.projectGraph.allWorkspaceFiles
.filter((f) => minimatch(f.file, withoutWorkspaceRoot))
.forEach((f) => {
parts.push(f.hash);
});
}
const value = this.hashing.hashArray(parts);
res({
value,
Expand Down

0 comments on commit f32eee9

Please sign in to comment.