Skip to content

Commit

Permalink
fix(nest): Fix generators (guard, interceptor etc...) path to not dup…
Browse files Browse the repository at this point in the history
…licate when provided

closes: #29076
  • Loading branch information
ndcunningham committed Nov 27, 2024
1 parent c75aa8f commit 3f51bc3
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 6 deletions.
2 changes: 1 addition & 1 deletion docs/generated/packages/nest/generators/guard.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
}
},
"additionalProperties": false,
"required": ["name"],
"required": ["path"],
"presets": []
},
"description": "Run the `guard` NestJS generator with Nx project support.",
Expand Down
2 changes: 1 addition & 1 deletion docs/generated/packages/nest/generators/interceptor.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
}
},
"additionalProperties": false,
"required": ["name"],
"required": ["path"],
"presets": []
},
"description": "Run the `interceptor` NestJS generator with Nx project support.",
Expand Down
2 changes: 1 addition & 1 deletion packages/nest/src/generators/guard/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,5 +39,5 @@
}
},
"additionalProperties": false,
"required": ["name"]
"required": ["path"]
}
2 changes: 1 addition & 1 deletion packages/nest/src/generators/interceptor/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,5 +39,5 @@
}
},
"additionalProperties": false,
"required": ["name"]
"required": ["path"]
}
6 changes: 4 additions & 2 deletions packages/nest/src/generators/utils/normalize-options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,18 @@ export async function normalizeOptions(
tree: Tree,
options: NestGeneratorOptions
): Promise<NormalizedOptions> {
const { directory, fileName } =
const { directory, artifactName } =
await determineArtifactNameAndDirectoryOptions(tree, {
name: options.name,
path: options.path,
});

options.path = undefined; // Now that we have `directory` we don't need `path`

return {
...options,
flat: true,
name: fileName,
name: artifactName,
skipFormat: options.skipFormat,
sourceRoot: directory,
};
Expand Down

0 comments on commit 3f51bc3

Please sign in to comment.