-
-
Notifications
You must be signed in to change notification settings - Fork 6.3k
Use prompt on a preset level #2529
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
Comments
https://cli.vuejs.org/guide/plugins-and-presets.html#remote-presets |
@sodatea |
@yuicer // prompts.js
module.exports = [{
name: 'useEslint',
type: 'confirm',
message: 'use eslint'
}] // generator.js
const path = require('path')
module.exports = (api, options, rootOptions) => {
if (options.useEslint) {
api.extendPackage({
devDependencies: {
'@vue/cli-plugin-eslint': '^3.1.5'
}
})
api.onCreateComplete(() => {
require('child_process').spawnSync(
'vue',
[
'invoke',
'@vue/cli-plugin-eslint',
// the following 4 lines can be commented out if you need the plugin prompts
'--config',
'standard',
'--lintOn',
'save,commit'
],
{
stdio: 'inherit',
cwd: path.join(process.cwd(), rootOptions.projectName)
})
})
}
} |
@sodatea 再次感谢~ |
What problem does this feature solve?
Now, if you want to share answers from prompts over multiple vue cli plugins, you need to ask the same question again in each plugin, because prompts are asked on plugin level. Wouldn't it be nice to make this available on preset level, so every plugin in the preset could use the ansers of the preset prompts
What does the proposed API look like?
add a prompst property to the presets json.
The text was updated successfully, but these errors were encountered: