goetzrobin / spartan

Cutting-edge tools powering Angular full-stack development.
https://spartan.ng
MIT License
1.29k stars 137 forks source link

Select dependencies not installed with CLI #350

Closed marcjulian closed 1 week ago

marcjulian commented 1 month ago

Please provide the environment you discovered this bug in.

Use npx nx g @spartan-ng/cli:ui select to add Select component to your NX project.

It should install all required dependencies. #320 added dependencies for @spartan-ng/ui-forms-brain and @spartan-ng/ui-form-field-brain.

Which area/package is the issue in?

select

Description

When adding Select component with the CLI (NX/Angular) the dependencies to @spartan-ng/ui-forms-brain and @spartan-ng/ui-form-field-brain should be installed. Maybe they should also be mentioned on the component page.

Currently the deps must be installed manually

npm install @spartan-ng/ui-forms-brain @spartan-ng/ui-form-field-brain

Please provide the exception or error you saw

No response

Other information

No response

I would be willing to submit a PR to fix this issue

marcjulian commented 1 month ago

@goetzrobin where should I add those dependencies? I think here https://github.com/goetzrobin/spartan/blob/main/libs/cli/src/generators/ui/generator.ts the deps for Icon and button is added. Should it be added here or in another place? Is there a place to describe each deps for one component?

Something like this:

export const primitiveDeps: Record<string, string[]> = {
     ...
     select: ['icon', 'forms', 'form-field'],
};
goetzrobin commented 3 weeks ago

@marcjulian I feel like we should use a similar approach as the addIconForDependentPrimitive function just for consistency or if you'd like to refactor to a map like you have in your comment I am cool with that, too!