Skip to content

Commit

Permalink
feat:catch error input
Browse files Browse the repository at this point in the history
  • Loading branch information
FliPPeDround committed Apr 12, 2024
1 parent 96c8437 commit f2f436d
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,10 @@ import {
import { join, resolve } from 'node:path'
import process from 'node:process'
import ejs from 'ejs'
import { bold } from 'kolorist'
import { bold, red } from 'kolorist'
import minimist from 'minimist'
import prompts from 'prompts'
import figures from 'prompts/lib/util/figures.js'
import { question } from './question'
import filePrompt from './question/file'
import type { BaseTemplateList } from './question/template/type'
Expand Down Expand Up @@ -250,8 +251,7 @@ async function init() {
printFinish(root, cwd, packageManager, loading)
}

init().catch((e) => {
loading.fail(`${bold('模板创建失败!')}`)
console.error(e)
process.exit(1)
init().catch(() => {
console.log(`${red(figures.cross)} ${bold('操作已取消')}`)

Check warning on line 255 in src/index.ts

View workflow job for this annotation

GitHub Actions / lint

Unexpected console statement
process.exit(0)
})

0 comments on commit f2f436d

Please sign in to comment.