Files
vue-cli/packages/@vue/cli/lib/util/generateReadme.js
Arthur Denner 278e992fbf feat: Generating README.md (#1717)
* feat: Generating README.md based on the package.json

* refactor: Adding missing scripts, changing descriptions and improving code

* chore: Moving stopSpinner to correct position and adding comment

* chore: Changing description to script test:e2e

* refactor: Removing unnecessary `if`
2018-07-04 13:16:49 +02:00

27 lines
693 B
JavaScript

const descriptions = {
build: 'Compiles and minifies for production',
serve: 'Compiles and hot-reloads for development',
lint: 'Lints and fixes files',
test: 'Run your tests',
'test:e2e': 'Run your end-to-end tests',
'test:unit': 'Run your unit tests'
}
function printScripts (pkg, packageManager) {
return Object.keys(pkg.scripts).map(key => {
return [
`\n### ${descriptions[key]}`,
`${packageManager} run ${key}\n`
].join('\n')
}).join('')
}
module.exports = function generateReadme (pkg, packageManager) {
return [
`# ${pkg.name}\n`,
'## Project setup',
`${packageManager} install`,
printScripts(pkg, packageManager)
].join('\n')
}