Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Errors when plugin is used in a preset #3

Open
bodograumann opened this issue Dec 5, 2018 · 10 comments
Open

Errors when plugin is used in a preset #3

bodograumann opened this issue Dec 5, 2018 · 10 comments

Comments

@bodograumann
Copy link
Contributor

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.

@bodograumann bodograumann changed the title Plugin can not be used in a preset Errors when plugin is used in a preset Dec 5, 2018
@David-Desmaisons
Copy link
Owner

Could you detail the step bu step scenario please; Thanks

@bodograumann
Copy link
Contributor Author

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
Copy link
Owner

David-Desmaisons commented Dec 15, 2018

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

@bodograumann
Copy link
Contributor Author

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
Copy link
Owner

What Os? Linux I guess?

@bodograumann
Copy link
Contributor Author

Yes: Linux 4.17.19-gentoo

@David-Desmaisons
Copy link
Owner

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
Copy link
Contributor Author

bodograumann commented Dec 23, 2018

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

@bodograumann
Copy link
Contributor Author

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
Copy link
Contributor Author

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

  • README.md and App.vue are not changed
  • No assets and components directories under src

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants