spartan-ng / spartan

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

Form Field CLI command not correct in docs #351

Open marcjulian opened 3 months ago

marcjulian commented 3 months ago

Please provide the environment you discovered this bug in.

Add Form Field component with npx nx g @spartan-ng/cli:ui form-field should request a directory and add the component. Instead the CLI prompts "Choose which primitives you want to copy...."

Looks like form-field is not available in the CLI, instead formfield.

CleanShot 2024-08-08 at 17 03 07

Which area/package is the issue in?

Docs

Description

Should update docs or CLI to use the correct name for the Form Field component.

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 3 months ago

@goetzrobin should the docs be updated or the formfield option to form-field in the CLI?

npx nx g @spartan-ng/cli:ui formfield works fine, but create the component under libs/ui/ui-formfield-helm/* instead of libs/ui/ui-form-field-helm.

goetzrobin commented 3 months ago

@marcjulian let's keep it the same as the others. how does e.g. aspectratio do it?

marcjulian commented 3 months ago

Aspect ratio uses aspectratio without a dash in the command, but also without a das in the package name.

# cli
npx nx g @spartan-ng/cli:ui aspectratio
# import lib
import { HlmAspectRatioDirective } from '@spartan-ng/ui-aspectratio-helm';

For Form Field that would mean to rename the command and also the import path. Do you want to keep the dash between form-field?

# cli
npx nx g @spartan-ng/cli:ui form-field
# import lib
import { HlmFormFieldModule } from '@spartan-ng/ui-form-field-helm';

or

# cli
npx nx g @spartan-ng/cli:ui formfield
# import lib
import { HlmFormFieldModule } from '@spartan-ng/ui-formfield-helm';
SimonHenz97 commented 3 months ago

I don't know if this is somehow releated, but I tried to install the formField component using the cli but it is missing most of the src content, only generating the test-setup.ts and an empty index.ts

image

cli: 0.0.1-alpha.361 ui: 0.0.1-alpha.353

marcjulian commented 3 months ago

@SimonHenz97 when I run the command npx nx g @spartan-ng/cli:ui formfield following files are copied

CleanShot 2024-08-12 at 19 18 18

Not sure if this is related. I am also using "@spartan-ng/cli": "0.0.1-alpha.361"

Perhaps libs/ui/ui-formfield-helm/src/lib/form-field.spec.ts could be ignored, as it imports from @testing-library/*.