Skip to content

Commit

Permalink
fix(core): store relative file name in hash details
Browse files Browse the repository at this point in the history
  • Loading branch information
AgentEnder committed May 5, 2022
1 parent 664df0e commit ad99040
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions packages/nx/src/hasher/hasher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { resolveNewFormatWithInlineProjects } from '../config/workspaces';
import { exec } from 'child_process';
import { existsSync } from 'fs';
import * as minimatch from 'minimatch';
import { join } from 'path';
import { join, sep as pathSep } from 'path';
import { performance } from 'perf_hooks';
import { getRootTsConfigFileName } from '../utils/typescript';
import { workspaceRoot } from '../utils/app-root';
Expand Down Expand Up @@ -243,6 +243,7 @@ export class Hasher {
'.nxignore',
];

const startsWithWorkspaceRoot = new RegExp(`^${workspaceRoot}${pathSep}`);
const fileHashes = [
...fileNames
.map((maybeRelativePath) => {
Expand All @@ -256,7 +257,7 @@ export class Hasher {
.map((file) => {
// we should use default file hasher here
const hash = this.hashing.hashFile(file);
return { file, hash };
return { file: file.replace(startsWithWorkspaceRoot, ''), hash };
}),
...this.hashNxJson(),
];
Expand Down

0 comments on commit ad99040

Please sign in to comment.