Skip to content

Commit

Permalink
feat: add colors to create-app options
Browse files Browse the repository at this point in the history
  • Loading branch information
yyx990803 committed Jan 8, 2021
1 parent 16cf3d0 commit cf7e43f
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 8 deletions.
17 changes: 9 additions & 8 deletions packages/create-app/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,18 @@ const fs = require('fs')
const path = require('path')
const argv = require('minimist')(process.argv.slice(2))
const { prompt } = require('enquirer')
const { yellow, green, cyan, magenta, stripColors } = require('kolorist')

const cwd = process.cwd()

const TEMPLATES = [
'vanilla',
'vue',
'vue-ts',
'react',
'react-ts',
'preact',
'preact-ts'
yellow('vanilla'),
green('vue'),
green('vue-ts'),
cyan('react'),
cyan('react-ts'),
magenta('preact'),
magenta('preact-ts')
]

const renameFiles = {
Expand Down Expand Up @@ -76,7 +77,7 @@ async function init() {
message: `Select a template:`,
choices: TEMPLATES
})
template = t
template = stripColors(t)
}

const templateDir = path.join(__dirname, `template-${template}`)
Expand Down
1 change: 1 addition & 0 deletions packages/create-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
"homepage": "https://github.com/vitejs/vite/tree/main/packages/create-app#readme",
"dependencies": {
"enquirer": "^2.3.6",
"kolorist": "^1.2.9",
"minimist": "^1.2.5"
}
}
5 changes: 5 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4669,6 +4669,11 @@ kleur@^3.0.3:
resolved "https://registry.yarnpkg.com/kleur/-/kleur-3.0.3.tgz#a79c9ecc86ee1ce3fa6206d1216c501f147fc07e"
integrity sha512-eTIzlVOSUR+JxdDFepEYcBMtZ9Qqdef+rnzWdRZuMbOywu5tO2w2N7rqjoANZ5k9vywhL6Br1VRjUIgTQx4E8w==

kolorist@^1.2.9:
version "1.2.9"
resolved "https://registry.yarnpkg.com/kolorist/-/kolorist-1.2.9.tgz#ccd5c68827c0385f0b26588321c3b6c4433dd2ab"
integrity sha512-mba6w9rkNlcMSSsGM1Xb9rgGFCDEL1APijLIkgtjsORyr9bKaSvQg/2fP8k7lwEiTh8WlMCHWREvf1ndguIKIQ==

launch-editor-middleware@^2.2.1:
version "2.2.1"
resolved "https://registry.yarnpkg.com/launch-editor-middleware/-/launch-editor-middleware-2.2.1.tgz#e14b07e6c7154b0a4b86a0fd345784e45804c157"
Expand Down

0 comments on commit cf7e43f

Please sign in to comment.