components icon indicating copy to clipboard operation
components copied to clipboard

non common part of path prefix is omitted

Open Decipher opened this issue 4 years ago • 5 comments

Describe the bug Some components are being incorrectly named:

- `<DruxtFieldNumberOfServings>` | `<druxt-field-number-of-servings>` (components/druxt/field/number/integer/FieldNumberOfServings.vue)

To Reproduce Steps to reproduce the behaviour:

  1. Clone repository: git clone https://github.com/druxt/demo.druxtjs.org.git
  2. Move components/druxt/field/NumberIntegerFieldNumberOfServings.vue to components/druxt/field/number/integer/FieldNumberOfServings.vue
  3. Run 'npm run build`
  4. See .nuxt/components/readme.md

Expected behaviour The file located at components/druxt/field/number/integer/FieldNumberOfServings.vue should be named DruxtFieldNumberIntegerFieldNumberOfServings

Screenshots N/A

Additional context A few of my components for comparison.

- `<DruxtViewRecipesPage1>` | `<druxt-view-recipes-page1>` (components/druxt/view/recipes/Page1.vue)
- `<DruxtFieldBooleanCheckboxForm>` | `<druxt-field-boolean-checkbox-form>` (components/druxt/field/boolean/checkbox/Form.vue)
- `<DruxtFieldImageImageForm>` | `<druxt-field-image-image-form>` (components/druxt/field/image/image/Form.vue)
- `<DruxtFieldRecipeCategory>` | `<druxt-field-recipe-category>` (components/druxt/field/entity-reference/label/FieldRecipeCategory.vue)
- `<DruxtFieldTags>` | `<druxt-field-tags>` (components/druxt/field/entity-reference/label/FieldTags.vue)
- `<DruxtFieldCookingTime>` | `<druxt-field-cooking-time>` (components/druxt/field/number/integer/FieldCookingTime.vue)
- `<DruxtFieldNumberOfServings>` | `<druxt-field-number-of-servings>` (components/druxt/field/number/integer/FieldNumberOfServings.vue)
- `<DruxtFieldMediaLibraryWidgetForm>` | `<druxt-field-media-library-widget-form>` (components/druxt/field/media-library/widget/Form.vue)
- `<DruxtFieldOptionsSelectForm>` | `<druxt-field-options-select-form>` (components/druxt/field/options/select/Form.vue)
- `<DruxtEntityFormNodeRecipeDefault>` | `<druxt-entity-form-node-recipe-default>` (components/druxt/entity/form/node/recipe/Default.vue)
- `<DruxtFieldEntityReferenceAutocompleteTagsForm>` | `<druxt-field-entity-reference-autocomplete-tags-form>` (components/druxt/field/entity-reference/autocomplete/tags/Form.vue)

Note that number/integer appears to be a potential lead.

Decipher avatar Mar 31 '21 05:03 Decipher

Just to clarify, your expected behavior for components/druxt/field/number/integer/FieldNumberOfServings.vue is to be named DruxtFieldNumberIntegerOfServings right?

pi0 avatar Mar 31 '21 09:03 pi0

Yes, correct. I also fixed the typo.

Decipher avatar Mar 31 '21 09:03 Decipher

From your edited comment, seems expected is DruxtFieldNumberIntegerFieldNumberOfServings (adding full path as prefix regardless). But it is not how prefixing works. We remove common part as duplicate so components/Foo/Bar/FooBarBaz.vue will be FooBarBaz and not FooBarFooBarBaz). For https://github.com/nuxt/components/issues/175#issuecomment-810917147, I've made proposal PR #177

pi0 avatar Apr 01 '21 11:04 pi0

I had a similar problem. The component was located at /components/tile-display/TileViewer.vue and the component was actually named TileDisplayTileViewer, but when the component tag was generated it came out as <tile-viewer. I think the autoload module should either not remove common parts or at least explain how it works in the docs. Took me a while to figure out why my component could not be found.

juventus18 avatar Oct 14 '21 21:10 juventus18

This is still very much on my radar, I will try to test out the PR next week.

Decipher avatar Oct 15 '21 06:10 Decipher