Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 18 additions & 13 deletions meta.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,12 @@ const {
runLintFix,
printMessage,
} = require('./utils')

const pkg = require('./package.json')

const templateVersion = pkg.version

const { addTestAnswers } = require('./scenarios')
const { addTestAnswers, isTest } = require('./scenarios')

module.exports = {
metalsmith: {
Expand All @@ -32,27 +33,36 @@ module.exports = {
},
},

prompts: {
// We don't add prompts if this is running in a test
prompts: isTest
? { // This dummy object is necessary to skpi vue-cli prompt defaults for name and author
name: {
type: 'string',
message: 'Name',
when: 'false'
},
author: {
type: 'string',
message: 'Author',
when: 'false'
}
} : { // The "real" prompts begin here
name: {
when: 'isNotTest',
type: 'string',
required: true,
message: 'Project name',
},
description: {
when: 'isNotTest',
type: 'string',
required: false,
message: 'Project description',
default: 'A Vue.js project',
},
author: {
when: 'isNotTest',
type: 'string',
message: 'Author',
},
build: {
when: 'isNotTest',
type: 'list',
message: 'Vue build',
choices: [
Expand All @@ -70,17 +80,15 @@ module.exports = {
],
},
router: {
when: 'isNotTest',
type: 'confirm',
message: 'Install vue-router?',
},
lint: {
when: 'isNotTest',
type: 'confirm',
message: 'Use ESLint to lint your code?',
},
lintConfig: {
when: 'isNotTest && lint',
when: 'lint',
type: 'list',
message: 'Pick an ESLint preset',
choices: [
Expand All @@ -102,12 +110,11 @@ module.exports = {
],
},
unit: {
when: 'isNotTest',
type: 'confirm',
message: 'Set up unit tests',
},
runner: {
when: 'isNotTest && unit',
when: 'unit',
type: 'list',
message: 'Pick a test runner',
choices: [
Expand All @@ -129,12 +136,10 @@ module.exports = {
],
},
e2e: {
when: 'isNotTest',
type: 'confirm',
message: 'Setup e2e tests with Nightwatch?',
},
autoInstall: {
when: 'isNotTest',
type: 'list',
message:
'Should we run `npm install` for you after the project has been created? (recommended)',
Expand Down