From b729fed5116feaeae7bcc13c35aceeed1dbfe16c Mon Sep 17 00:00:00 2001 From: Craigory Coppola Date: Mon, 26 Apr 2021 16:12:58 -0500 Subject: [PATCH] fix(core): output paths still use windows separator on linux / mac --- .releaserc.js | 2 +- .../src/generators/utils/generate-project.spec.ts | 2 +- .../core/src/generators/utils/generate-project.ts | 11 +++++++---- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/.releaserc.js b/.releaserc.js index f95cafca..23fac413 100644 --- a/.releaserc.js +++ b/.releaserc.js @@ -37,7 +37,7 @@ module.exports = { { publishCmd: [ 'yarn ts-node tools/scripts/publish-all ${nextRelease.version} ${nextRelease.channel}', - ], + ].join(' && '), }, ], [ diff --git a/packages/core/src/generators/utils/generate-project.spec.ts b/packages/core/src/generators/utils/generate-project.spec.ts index d7b27bd8..eda1ebf1 100644 --- a/packages/core/src/generators/utils/generate-project.spec.ts +++ b/packages/core/src/generators/utils/generate-project.spec.ts @@ -72,7 +72,7 @@ describe('nx-dotnet project generator', () => { expect(outputPath).toBeTruthy(); // eslint-disable-next-line @typescript-eslint/no-non-null-assertion - const absoluteDistPath = resolve(resolve(config.root, outputPath)); + const absoluteDistPath = resolve(config.root, outputPath); const expectedDistPath = resolve('./dist/test'); expect(absoluteDistPath).toEqual(expectedDistPath); diff --git a/packages/core/src/generators/utils/generate-project.ts b/packages/core/src/generators/utils/generate-project.ts index 58b76c37..3348b737 100644 --- a/packages/core/src/generators/utils/generate-project.ts +++ b/packages/core/src/generators/utils/generate-project.ts @@ -138,11 +138,14 @@ function SetOutputPath( readFileSync(projectFilePath).toString() ); + let outputPath = `${relative( + dirname(projectFilePath), + process.cwd() + )}/dist/${projectName}`; + outputPath = outputPath.replace('\\', '/'); // Forward slash works on windows, backslash does not work on mac/linux + const textNode: Partial = { - text: `${relative( - dirname(projectFilePath), - process.cwd() - )}\\dist\\${projectName}`, + text: outputPath, type: 'text', }; textNode.toString = () => textNode.text ?? '';