nuxt / components

Scan and auto import components for Nuxt.js 2.13+

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

non common part of path prefix is omitted

Decipher opened this issue · 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.

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

Yes, correct. I also fixed the typo.

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 #175 (comment), I've made proposal PR #177

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.

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