Skip to content

Commit

Permalink
fix(utils): getDependantProjectsForNxProject should work on Unix
Browse files Browse the repository at this point in the history
inconsistent directory separators between .net CLI caused path.resolve to behave weirdly.

fixes #43
  • Loading branch information
AgentEnder committed May 19, 2021
1 parent e2b1cfc commit 96cbc33
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"e2e-registry": "yarn verdaccio --config ./tools/scripts/local-registry/config.yml --listen 4872",
"e2e-tests": "ts-node -P ./tools/scripts/tsconfig.e2e.json ./tools/scripts/e2e.ts",
"e2e": "run-p -r e2e-registry \"e2e-tests {@}\" --",
"publish-local": "run-p \"rimraf tmp\" e2e-registry \"ts-node ./tools/scripts/publish-all 99.99.99 local\"",
"publish-local": "cp .npmrc.local .npmrc && run-p \"rimraf tmp\" e2e-registry \"ts-node ./tools/scripts/publish-all 99.99.99 local\"",
"semantic-release": "semantic-release",
"ts-node": "ts-node",
"rimraf": "rimraf"
Expand Down Expand Up @@ -93,4 +93,4 @@
"url": "https://github.com/nx-dotnet/nx-dotnet.git"
},
"version": "0.6.1"
}
}
8 changes: 3 additions & 5 deletions packages/utils/src/lib/utility-functions/workspace.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,22 +45,20 @@ export function getDependantProjectsForNxProject(
const netProjectFilePath = getProjectFileForNxProjectSync(
workspaceConfiguration.projects[targetProject],
);
const hostProjectDirectory = dirname(netProjectFilePath).replace(/\\/g, '/');

const xml: XmlDocument = new XmlDocument(
readFileSync(netProjectFilePath).toString(),
);

xml.childrenNamed('ItemGroup').forEach((itemGroup) =>
itemGroup.childrenNamed('ProjectReference').forEach((x: XmlElement) => {
const includeFilePath = x.attr['Include'];
const includeFilePath = x.attr['Include'].replace(/\\/g, '/');
let absoluteFilePath: string;
if (isAbsolute(includeFilePath)) {
absoluteFilePath = includeFilePath;
} else {
absoluteFilePath = resolve(
dirname(netProjectFilePath),
includeFilePath,
);
absoluteFilePath = resolve(hostProjectDirectory, includeFilePath);
}

Object.entries(projectRoots).forEach(([dependency, path]) => {
Expand Down

0 comments on commit 96cbc33

Please sign in to comment.