Repository navigation
Conversation
…criptive error
The entry-point schematic accepts any name that is a valid npm export
subpath, but the final path segment is also used to name the generated
class, selector, and source files. A segment that cannot be used that
way fails deep inside the component schematic with an error about
something the user never provided: `ng generate entry-point 3d` fails
with 'Selector "lib-3d" is invalid.' and `ng generate entry-point
svg~icons` fails with a raw schema validation dump of the internal
component options.
Validate the final path segment up front and report the entry point
name together with the allowed shape. Dots remain supported, as
`classify` removes them when deriving the class name ('testing.v2'
generates the class `TestingV2`); a test now covers that case to keep
it working.
There was a problem hiding this comment.
Code Review
This pull request introduces validation for the entry point name in the Angular entry-point schematic. It ensures that the final path segment of the entry point name is a valid identifier (starting with a letter and containing only alphanumeric characters, dots, dashes, and underscores) to prevent downstream failures when naming generated source files. Additionally, unit tests have been added to verify both the error handling for invalid names and the acceptance of valid names containing dots. No review comments were provided, and the changes look solid and well-tested.
alan-agius4
left a comment
There was a problem hiding this comment.
All of these are valid entry-point names; the bug lies in the artifactName generation.
…h a descriptive error
Thanks — reworked in the latest commit. Instead of rejecting these names, the schematic now derives a usable artifact name from them, while the exports entry and directory keep the original name:
Happy to adjust the fallback naming if you'd prefer a different shape. |
The entry-point schematic accepts any name that is a valid npm export subpath, but the final path segment is also used to name the generated class, selector, and source files. A segment that cannot be used that way fails deep inside the component schematic with an error about something the user never provided:
ng generate entry-point 3dfails with 'Selector "lib-3d" is invalid.' andng generate entry-point svg~iconsfails with a raw schema validation dump of the internal component options.Validate the final path segment up front and report the entry point name together with the allowed shape. Dots remain supported, as
classifyremoves them when deriving the class name ('testing.v2' generates the classTestingV2); a test now covers that case to keep it working.