David-Desmaisons / vue-cli-plugin-component

πŸ› οΈ vue-cli 3 plugin to create component
MIT License
88 stars 6 forks source link

Errors when plugin is used in a preset #3

Open bodograumann opened 5 years ago

bodograumann commented 5 years ago

When creating a vue project with the following preset:

{
  "plugins": {
    "vue-cli-plugin-component": {
      "prompts": true
    }
  }
}

and answering no to all the questions, there is no new content added to the readme file. Also the asset directory is not deleted.

David-Desmaisons commented 5 years ago

Could you detail the step bu step scenario please; Thanks

bodograumann commented 5 years ago

Sure. Have vue-cli-3 installed. Create a file called component-preset.json with the content

{
  "plugins": {
    "vue-cli-plugin-component": {
      "prompts": true
    }
  }
}

Then call vue create --preset component-preset.json test-component. Give the component name and answer no to all the questions. (Alternatively you could probably remove "prompts": true in the preset and predefine the name instead, but I did not look up what the name setting is called for your plugin.)

David-Desmaisons commented 5 years ago

Tried to reproduce today your scenario with last version of the plugin: everything worked.

bodograumann commented 5 years ago

That is weird. Are you certain? This is what I get with the latest version 1.10.5:

[…]
πŸš€  Invoking generators... 

vue-cli-plugin-component
? Enter the component name (in PascalCase- no hyphen nor dash): TestComponent
? Use componentFixture to build example? No
? Use vue-styleguidist to generate documentation? No
? Use vuedoc.md to automatically generate README API section? No
? Add project badges to README.md? No
? Add license? No
File not found README.md
πŸ“¦  Installing additional dependencies... 
[…]

Note the β€œFile not found README.md”.

I’m on node v8.12.0, if that has anything to do with it…

David-Desmaisons commented 5 years ago

What Os? Linux I guess?

bodograumann commented 5 years ago

Yes: Linux 4.17.19-gentoo

David-Desmaisons commented 5 years ago

Which version of vue-cli? If it is not the last one, could you please update your vue-cli version and try to reproduce?

bodograumann commented 5 years ago

It is the latest version: @vue/cli@3.2.1 I just did do npm update -g.

bodograumann commented 5 years ago

Please try my reproduction: https://github.com/bodograumann/component-plugin-test It seems to me, that vue-cli is generating the README.md only after the plugin generators have been run. At least for preset generators I know it is possible to postpone running some modifications with api.onCreateComplete(mycallback). Maybe this is needed here as well.

bodograumann commented 5 years ago

There are also several differences in comparison to using vue add component afterwards: