Closed
Description
Version
4.1.2
Environment info
Environment Info:
System:
OS: Linux 4.15 Ubuntu 18.04.3 LTS (Bionic Beaver)
CPU: (8) x64 Intel(R) Core(TM) i7-7700HQ CPU @ 2.80GHz
Binaries:
Node: 12.13.1 - /usr/local/bin/node
Yarn: 1.21.1 - /usr/bin/yarn
npm: 6.13.4 - /usr/local/bin/npm
Browsers:
Chrome: 79.0.3945.130
Firefox: 72.0.2
npmGlobalPackages:
@vue/cli: 4.1.2
Steps to reproduce
Create a plugin with a prompt.js
file that exports a function, eg:
// prompts.js
// pass `package.json` of project to function argument
module.exports = pkg => {
const prompts = [
{
type: 'input',
name: 'locale',
message: 'The locale of project localization.',
validate: input => !!input,
default: 'en'
}
]
// add dynamically prompt
if ('@vue/cli-plugin-eslint' in (pkg.devDependencies || {})) {
prompts.push({
type: 'confirm',
name: 'useESLintPluginVueI18n',
message: 'Use ESLint plugin for Vue I18n ?'
})
}
return prompts
}
(from the docs https://cli.vuejs.org/dev-guide/plugin-dev.html#prompts)
Use that plugin in a preset and try to create a project using it
What is expected?
The function is called without error
What is actually happening?
This error occurs:
ERROR TypeError: obs.pipe is not a function
TypeError: obs.pipe is not a function
at PromptUI.run (/usr/local/lib/node_modules/@vue/cli/node_modules/inquirer/lib/ui/prompt.js:33:24)
at Object.promptModule [as prompt] (/usr/local/lib/node_modules/@vue/cli/node_modules/inquirer/lib/inquirer.js:28:22)
at Creator.resolvePlugins (/usr/local/lib/node_modules/@vue/cli/lib/Creator.js:382:36)
at Creator.create (/usr/local/lib/node_modules/@vue/cli/lib/Creator.js:196:32)
at processTicksAndRejections (internal/process/task_queues.js:93:5)
at async create (/usr/local/lib/node_modules/@vue/cli/lib/create.js:72:3)
I think it's because there is no check on prompts
type on this line https://github.com/vuejs/vue-cli/blob/dev/packages/%40vue/cli/lib/Creator.js#L384