v2.0.0
Note: although there are many changes, vue-cli@2.x is largely compatible with 1.x templates. Special thanks to @zigomir for the contribution.
Changes
- Use
promptsinstead ofschemafor user prompts inmeta.json. vue-clino longer auto-scan template files to look for prompt variables. Now it is required to explicitly list prompts inmeta.json.- User prompts now uses Inquirer.js, so
promptsshould follow Inquirer.js' question object format. - For official templates,
vue-cliwill first check if the template has adistbranch, if there is one, it will use thedistbranch by default.
New
-
A prompt can be made conditional by adding a
whenfield, which is a JavaScript expression evaluated in the context of existing prompt answer data. Example:{ "prompts": { "lint": { "type": "confirm", "message": "Use a linter?" }, "lintConfig": { "when": "lint", "type": "list", "message": "Pick a lint config", "choices": [ "standard", "airbnb", "none" ] } } } -
Conditional files by using the
filtersfield inmeta.json.filtersshould be an object hash containing file filtering rules. For each entry, the key is a minimatch glob pattern and the value is a JavaScript expression evaluated in the context of prompt answers data. Example:{ "filters": { "test/**/*": "needTests" } }Files under
testwill only be generated if the user answered yes to the prompt forneedTests.Note that the
dotoption for minimatch is set totrueso glob patterns would also match dotfiles by default.