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

Remote preset prompts #952

Closed
Kminkjan opened this issue Mar 7, 2018 · 2 comments
Closed

Remote preset prompts #952

Kminkjan opened this issue Mar 7, 2018 · 2 comments

Comments

@Kminkjan
Copy link

Kminkjan commented Mar 7, 2018

What problem does this feature solve?

I have created a remote preset that uses a 3rd party plugin that I created for my company. It uses a predefined config for the default Vue cli plugins and then should allow to make some customizations from the 3rd party plugin. The current way it works is that all the default plugins are installed, and then my 3rd party plugin. However, I discovered it would fail, because the prompts are not executed.

The ideal workflow would be like this: the developer that uses the preset executes the vue create command and a default Vue app is created with predefined default plugins and it's configuration. When the default plugins finish installing, the prompts from the 3rd party plugin would still execute so the app can be customized to the few options my company needs.

My remote preset looks like this:

{
      "useConfigFiles": false,
      "plugins": {
        "@vue/cli-plugin-babel": {},
        "@vue/cli-plugin-eslint": {
          "config": "standard",
          "lintOn": [
            "save"
          ]
        },
        "@vue/cli-plugin-unit-jest": {},
        "@vue/cli-plugin-e2e-cypress": {},
    	"@mycompany/mypreset": {"version": "^1.0.0"}
      },
      "router": true,
      "vuex": true,
      "cssPreprocessor": "stylus"
    }

What does the proposed API look like?

I purpose that the plugin config allows for an flag that can be set, which will (when set to true) still execute the prompts.

{
      "useConfigFiles": false,
      "plugins": {
        "@vue/cli-plugin-babel": {},
        "@vue/cli-plugin-eslint": {
          "config": "standard",
          "lintOn": [
            "save"
          ]
        },
        "@vue/cli-plugin-unit-jest": {},
        "@vue/cli-plugin-e2e-cypress": {},
    	"@mycompany/mypreset": {"version": "^1.0.0", "prompts": true}
      },
      "router": true,
      "vuex": true,
      "cssPreprocessor": "stylus"
    }
@andreasvirkus
Copy link

andreasvirkus commented Apr 4, 2018

Just throwing an alternative approach into the ring. Maybe we could check if:
a) the custom plugin has no config passed in the preset
b) the custom plugin has prompts.js

if a && b, then present the user with prompts for that plugin?

I'm facing a similar issue atm and the workaround is that the plugins aren't
listed in the preset, but users add them manually via npm and vue invoke (or simply vue add)

@yyx990803
Copy link
Member

I think it's better to be explicit so I implemented support for { prompts: true }. Note this works for all presets, not just remote ones.

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

4 participants