fix(core): windows filePaths should be handled in findProjectForPath (#17688)

This commit is contained in:
Colum Ferry 2023-06-20 14:46:32 +01:00 committed by GitHub
parent 238ad4aa24
commit c46f0259af
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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>;
@ -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);