feat: support --bare flag when creating new projects

close #2030
This commit is contained in:
Evan You
2018-08-03 11:45:10 -07:00
parent 350f77b958
commit c6ca93e0dd
6 changed files with 20 additions and 1 deletions
@@ -1,9 +1,14 @@
<template>
<div class="home">
<img src="../assets/logo.png">
<%_ if (!rootOptions.bare) { _%>
<HelloWorld msg="Welcome to Your Vue.js App"/>
<%_ } else { _%>
<h1>Welcome to Your Vue.js App</h1>
<%_ } _%>
</div>
</template>
<%_ if (!rootOptions.bare) { _%>
<script>
// @ is an alias to /src
@@ -16,3 +21,4 @@ export default {
}
}
</script>
<%_ } _%>
@@ -2,9 +2,14 @@
<template>
<div id="app">
<img src="./assets/logo.png">
<%_ if (!rootOptions.bare) { _%>
<HelloWorld msg="Welcome to Your Vue.js App"/>
<%_ } else { _%>
<h1>Welcome to Your Vue.js App</h1>
<%_ } _%>
</div>
</template>
<%_ if (!rootOptions.bare) { _%>
<script>
import HelloWorld from './components/HelloWorld.vue'
@@ -16,6 +21,7 @@ export default {
}
}
</script>
<%_ } _%>
<%_ } else { _%>
<template>
<div id="app">
@@ -27,8 +33,9 @@ export default {
</div>
</template>
<%_ } _%>
<%_ if (!rootOptions.bare) { _%>
<%_ if (rootOptions.cssPreprocessor !== 'stylus') { _%>
<style<%-
rootOptions.cssPreprocessor
? ` lang="${
@@ -99,3 +106,4 @@ export default {
<%_ } _%>
</style>
<%_ } _%>
<%_ } _%>
@@ -1,3 +1,4 @@
<%_ if (!rootOptions.bare) { _%>
<template>
<div class="hello">
<h1>{{ msg }}</h1>
@@ -83,3 +84,4 @@ a
color #42b983
</style>
<%_ } _%>
<%_ } _%>
+1
View File
@@ -54,6 +54,7 @@ program
.option('-f, --force', 'Overwrite target directory if it exists')
.option('-c, --clone', 'Use git clone when fetching remote preset')
.option('-x, --proxy', 'Use specified proxy when creating project')
.option('-b, --bare', 'Scaffold project without beginner instructions')
.action((name, cmd) => {
const options = cleanArgs(cmd)
// --no-git makes commander to default git to true
+1
View File
@@ -87,6 +87,7 @@ module.exports = class Creator extends EventEmitter {
preset = cloneDeep(preset)
// inject core service
preset.plugins['@vue/cli-service'] = Object.assign({
bare: cliOptions.bare,
projectName: name
}, preset)
+1
View File
@@ -8,6 +8,7 @@ const { createSchema, validate } = require('@vue/cli-shared-utils/lib/validate')
const rcPath = exports.rcPath = getRcPath('.vuerc')
const presetSchema = createSchema(joi => joi.object().keys({
bare: joi.boolean(),
useConfigFiles: joi.boolean(),
router: joi.boolean(),
routerHistoryMode: joi.boolean(),