Skip to content

Commit

Permalink
fix: remove relative path format
Browse files Browse the repository at this point in the history
  • Loading branch information
kaankoken committed Aug 29, 2024
1 parent 51080fc commit 1214b75
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
2 changes: 1 addition & 1 deletion packages/rust/src/generators/binary/generator.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ describe('rust generator', () => {
},
"workspace": Object {
"members": Array [
"./test_name",
"test_name",
],
"resolver": "2",
},
Expand Down
2 changes: 1 addition & 1 deletion packages/rust/src/generators/library/generator.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ describe('rust generator', () => {
},
"workspace": Object {
"members": Array [
"./test_name",
"test_name",
],
"resolver": "2",
},
Expand Down
9 changes: 6 additions & 3 deletions packages/rust/src/utils/add-to-workspace.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 1214b75

Please sign in to comment.