Gathering detailed insights and metrics for vue-cli
Gathering detailed insights and metrics for vue-cli
Gathering detailed insights and metrics for vue-cli
Gathering detailed insights and metrics for vue-cli
npm install vue-cli
Typescript
Module System
Min. Node Version
Node Version
NPM Version
64.9
Supply Chain
89.3
Quality
73.4
Maintenance
50
Vulnerability
95.6
License
JavaScript (75.05%)
Vue (22.89%)
TypeScript (0.87%)
Stylus (0.47%)
HTML (0.27%)
Shell (0.26%)
AppleScript (0.18%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
MIT License
29,725 Stars
3,533 Commits
6,326 Forks
629 Watchers
22 Branches
521 Contributors
Updated on Jul 10, 2025
Latest Version
2.9.6
Package Id
vue-cli@2.9.6
Size
17.80 kB
NPM Version
5.6.0
Node Version
8.11.1
Published on
Jun 05, 2018
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
A simple CLI for scaffolding Vue.js projects.
Prerequisites: Node.js (>=6.x, 8.x preferred), npm version 3+ and Git.
1$ npm install -g vue-cli
1$ vue init <template-name> <project-name>
Example:
1$ vue init webpack my-project
The above command pulls the template from vuejs-templates/webpack, prompts for some information, and generates the project at ./my-project/
.
Use vue-cli as a zero-configuration development tool for your Vue apps and component, check out the docs.
The purpose of official Vue project templates are to provide opinionated, battery-included development tooling setups so that users can get started with actual app code as fast as possible. However, these templates are un-opinionated in terms of how you structure your app code and what libraries you use in addition to Vue.js.
All official project templates are repos in the vuejs-templates organization. When a new template is added to the organization, you will be able to run vue init <template-name> <project-name>
to use that template. You can also run vue list
to see all available official templates.
Current available templates include:
webpack - A full-featured Webpack + vue-loader setup with hot reload, linting, testing & css extraction.
webpack-simple - A simple Webpack + vue-loader setup for quick prototyping.
browserify - A full-featured Browserify + vueify setup with hot-reload, linting & unit testing.
browserify-simple - A simple Browserify + vueify setup for quick prototyping.
pwa - PWA template for vue-cli based on the webpack template
simple - The simplest possible Vue setup in a single HTML file
It's unlikely to make everyone happy with the official templates. You can simply fork an official template and then use it via vue-cli
with:
1vue init username/repo my-project
Where username/repo
is the GitHub repo shorthand for your fork.
The shorthand repo notation is passed to download-git-repo so you can also use things like bitbucket:username/repo
for a Bitbucket repo and username/repo#branch
for tags or branches.
If you would like to download from a private repository use the --clone
flag and the cli will use git clone
so your SSH keys are used.
Instead of a GitHub repo, you can also use a template on your local file system:
1vue init ~/fs/path/to-custom-template my-project
A template repo must have a template
directory that holds the template files.
A template repo may have a metadata file for the template which can be either a meta.js
or meta.json
file. It can contain the following fields:
prompts
: used to collect user options data;
filters
: used to conditional filter files to render.
metalsmith
: used to add custom metalsmith plugins in the chain.
completeMessage
: the message to be displayed to the user when the template has been generated. You can include custom instruction here.
complete
: Instead of using completeMessage
, you can use a function to run stuffs when the template has been generated.
The prompts
field in the metadata file should be an object hash containing prompts for the user. For each entry, the key is the variable name and the value is an Inquirer.js question object. Example:
1{ 2 "prompts": { 3 "name": { 4 "type": "string", 5 "required": true, 6 "message": "Project name" 7 } 8 } 9}
After all prompts are finished, all files inside template
will be rendered using Handlebars, with the prompt results as the data.
A prompt can be made conditional by adding a when
field, which should be a JavaScript expression evaluated with data collected from previous prompts. For example:
1{ 2 "prompts": { 3 "lint": { 4 "type": "confirm", 5 "message": "Use a linter?" 6 }, 7 "lintConfig": { 8 "when": "lint", 9 "type": "list", 10 "message": "Pick a lint config", 11 "choices": [ 12 "standard", 13 "airbnb", 14 "none" 15 ] 16 } 17 } 18}
The prompt for lintConfig
will only be triggered when the user answered yes to the lint
prompt.
Two commonly used Handlebars helpers, if_eq
and unless_eq
are pre-registered:
1{{#if_eq lintConfig "airbnb"}};{{/if_eq}}
You may want to register additional Handlebars helpers using the helpers
property in the metadata file. The object key is the helper name:
1module.exports = { 2 helpers: { 3 lowercase: str => str.toLowerCase() 4 } 5}
Upon registration, they can be used as follows:
1{{ lowercase name }}
The filters
field in the metadata file should 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:
1{ 2 "filters": { 3 "test/**/*": "needTests" 4 } 5}
Files under test
will only be generated if the user answered yes to the prompt for needTests
.
Note that the dot
option for minimatch is set to true
so glob patterns would also match dotfiles by default.
The skipInterpolation
field in the metadata file should be a minimatch glob pattern. The files matched should skip rendering. Example:
1{ 2 "skipInterpolation": "src/**/*.vue" 3}
vue-cli
uses metalsmith to generate the project.
You may customize the metalsmith builder created by vue-cli to register custom plugins.
1{ 2 "metalsmith": function (metalsmith, opts, helpers) { 3 function customMetalsmithPlugin (files, metalsmith, done) { 4 // Implement something really custom here. 5 done(null, files) 6 } 7 8 metalsmith.use(customMetalsmithPlugin) 9 } 10}
If you need to hook metalsmith before questions are asked, you may use an object with before
key.
1{ 2 "metalsmith": { 3 before: function (metalsmith, opts, helpers) {}, 4 after: function (metalsmith, opts, helpers) {} 5 } 6}
destDirName
- destination directory name1{ 2 "completeMessage": "To get started:\n\n cd {{destDirName}}\n npm install\n npm run dev" 3}
inPlace
- generating template into current directory1{ 2 "completeMessage": "{{#inPlace}}To get started:\n\n npm install\n npm run dev.{{else}}To get started:\n\n cd {{destDirName}}\n npm install\n npm run dev.{{/inPlace}}" 3}
complete
functionArguments:
data
: the same data you can access in completeMessage
:
1{ 2 complete (data) { 3 if (!data.inPlace) { 4 console.log(`cd ${data.destDirName}`) 5 } 6 } 7}
helpers
: some helpers you can use to log results.
chalk
: the chalk
modulelogger
: the built-in vue-cli loggerfiles
: An array of generated files1{ 2 complete (data, {logger, chalk}) { 3 if (!data.inPlace) { 4 logger.log(`cd ${chalk.yellow(data.destDirName)}`) 5 } 6 } 7}
vue-cli
uses the tool download-git-repo
to download the official templates used. The download-git-repo
tool allows you to indicate a specific branch for a given repository by providing the desired branch name after a pound sign (#
).
The format needed for a specific official template is:
vue init '<template-name>#<branch-name>' <project-name>
Example:
Installing the 1.0
branch of the webpack-simple vue template:
vue init 'webpack-simple#1.0' mynewproject
Note: The surrounding quotes are necessary on zsh shells because of the special meaning of the #
character.
No vulnerabilities found.
Reason
license file detected
Details
Reason
no binaries found in the repo
Reason
Found 5/29 approved changesets -- score normalized to 1
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Reason
project is not fuzzed
Details
Reason
120 existing vulnerabilities detected
Details
Score
Last Scanned on 2025-06-30
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More