Skip to content

Commit

Permalink
fix(create-vite): use reset for prompts for white bg color shell (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
userquin committed Jan 17, 2022
1 parent bfbdb22 commit dd3bbb8
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions packages/create-vite/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ const {
blue,
magenta,
lightRed,
red
red,
reset
} = require('kolorist')

const cwd = process.cwd()
Expand Down Expand Up @@ -141,7 +142,7 @@ async function init() {
{
type: targetDir ? null : 'text',
name: 'projectName',
message: 'Project name:',
message: reset('Project name:'),
initial: defaultProjectName,
onState: (state) =>
(targetDir = state.value.trim() || defaultProjectName)
Expand All @@ -168,7 +169,7 @@ async function init() {
{
type: () => (isValidPackageName(targetDir) ? null : 'text'),
name: 'packageName',
message: 'Package name:',
message: reset('Package name:'),
initial: () => toValidPackageName(targetDir),
validate: (dir) =>
isValidPackageName(dir) || 'Invalid package.json name'
Expand All @@ -178,8 +179,10 @@ async function init() {
name: 'framework',
message:
typeof template === 'string' && !TEMPLATES.includes(template)
? `"${template}" isn't a valid template. Please choose from below: `
: 'Select a framework:',
? reset(
`"${template}" isn't a valid template. Please choose from below: `
)
: reset('Select a framework:'),
initial: 0,
choices: FRAMEWORKS.map((framework) => {
const frameworkColor = framework.color
Expand All @@ -193,7 +196,7 @@ async function init() {
type: (framework) =>
framework && framework.variants ? 'select' : null,
name: 'variant',
message: 'Select a variant:',
message: reset('Select a variant:'),
// @ts-ignore
choices: (framework) =>
framework.variants.map((variant) => {
Expand Down

0 comments on commit dd3bbb8

Please sign in to comment.