Skip to content

Commit 96cbc33

Browse files
author
Craigory Coppola
committed
fix(utils): getDependantProjectsForNxProject should work on Unix
inconsistent directory separators between .net CLI caused path.resolve to behave weirdly. fixes #43
1 parent e2b1cfc commit 96cbc33

File tree

2 files changed

+5
-7
lines changed

2 files changed

+5
-7
lines changed

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
"e2e-registry": "yarn verdaccio --config ./tools/scripts/local-registry/config.yml --listen 4872",
2929
"e2e-tests": "ts-node -P ./tools/scripts/tsconfig.e2e.json ./tools/scripts/e2e.ts",
3030
"e2e": "run-p -r e2e-registry \"e2e-tests {@}\" --",
31-
"publish-local": "run-p \"rimraf tmp\" e2e-registry \"ts-node ./tools/scripts/publish-all 99.99.99 local\"",
31+
"publish-local": "cp .npmrc.local .npmrc && run-p \"rimraf tmp\" e2e-registry \"ts-node ./tools/scripts/publish-all 99.99.99 local\"",
3232
"semantic-release": "semantic-release",
3333
"ts-node": "ts-node",
3434
"rimraf": "rimraf"
@@ -93,4 +93,4 @@
9393
"url": "https://github.com/nx-dotnet/nx-dotnet.git"
9494
},
9595
"version": "0.6.1"
96-
}
96+
}

packages/utils/src/lib/utility-functions/workspace.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,22 +45,20 @@ export function getDependantProjectsForNxProject(
4545
const netProjectFilePath = getProjectFileForNxProjectSync(
4646
workspaceConfiguration.projects[targetProject],
4747
);
48+
const hostProjectDirectory = dirname(netProjectFilePath).replace(/\\/g, '/');
4849

4950
const xml: XmlDocument = new XmlDocument(
5051
readFileSync(netProjectFilePath).toString(),
5152
);
5253

5354
xml.childrenNamed('ItemGroup').forEach((itemGroup) =>
5455
itemGroup.childrenNamed('ProjectReference').forEach((x: XmlElement) => {
55-
const includeFilePath = x.attr['Include'];
56+
const includeFilePath = x.attr['Include'].replace(/\\/g, '/');
5657
let absoluteFilePath: string;
5758
if (isAbsolute(includeFilePath)) {
5859
absoluteFilePath = includeFilePath;
5960
} else {
60-
absoluteFilePath = resolve(
61-
dirname(netProjectFilePath),
62-
includeFilePath,
63-
);
61+
absoluteFilePath = resolve(hostProjectDirectory, includeFilePath);
6462
}
6563

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

0 commit comments

Comments
 (0)