Skip to content

Commit

Permalink
fix(core): windows filePaths should be handled in findProjectForPath
Browse files Browse the repository at this point in the history
  • Loading branch information
Coly010 committed Jun 20, 2023
1 parent 2c47bba commit 926bd14
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion packages/nx/src/project-graph/utils/find-project-for-path.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { dirname } from 'path';
import { ProjectGraphProjectNode } from '../../config/project-graph';
import { ProjectConfiguration } from '../../config/workspace-json-project-json';
import { normalizePath } from '../../utils/path';

export type ProjectRootMappings = Map<string, string>;

Expand Down Expand Up @@ -44,7 +45,12 @@ export function findProjectForPath(
filePath: string,
projectRootMap: ProjectRootMappings
): string | null {
let currentPath = filePath;
/**
* Project Mappings are in UNIX-style file paths
* Windows may pass Win-style file paths
* Ensure filePath is in UNIX-style
*/
let currentPath = normalizePath(filePath);
for (
;
currentPath != dirname(currentPath);
Expand Down

0 comments on commit 926bd14

Please sign in to comment.