diff --git a/packages/rust/src/generators/binary/generator.spec.ts b/packages/rust/src/generators/binary/generator.spec.ts index 3447aca..0b29960 100644 --- a/packages/rust/src/generators/binary/generator.spec.ts +++ b/packages/rust/src/generators/binary/generator.spec.ts @@ -61,7 +61,7 @@ describe('rust generator', () => { }, "workspace": Object { "members": Array [ - "./test_name", + "test_name", ], "resolver": "2", }, diff --git a/packages/rust/src/generators/library/generator.spec.ts b/packages/rust/src/generators/library/generator.spec.ts index d13f64d..b315b9e 100644 --- a/packages/rust/src/generators/library/generator.spec.ts +++ b/packages/rust/src/generators/library/generator.spec.ts @@ -61,7 +61,7 @@ describe('rust generator', () => { }, "workspace": Object { "members": Array [ - "./test_name", + "test_name", ], "resolver": "2", }, diff --git a/packages/rust/src/utils/add-to-workspace.ts b/packages/rust/src/utils/add-to-workspace.ts index c6287c7..58aa2d8 100644 --- a/packages/rust/src/utils/add-to-workspace.ts +++ b/packages/rust/src/utils/add-to-workspace.ts @@ -18,10 +18,13 @@ export function addToCargoWorkspace(tree: Tree, projectPath: string) { throw new Error('Cargo.toml workspace section does not contain members'); } - if (members.includes(projectPath)) { - logger.info(`${projectPath} already exists in the Cargo.toml members`); + // Remove leading './' if it exists + const cleanProjectPath = projectPath.replace(/^\.\//, ''); + + if (members.includes(cleanProjectPath)) { + logger.info(`${cleanProjectPath} already exists in the Cargo.toml members`); } else { - workspace.members = members.concat([projectPath]); + workspace.members = members.concat([cleanProjectPath]); } const newCargoToml = stringifyCargoToml(cargoToml);