From f2f436dfb6e77162dbef11c0c2ab7412bddb2c64 Mon Sep 17 00:00:00 2001 From: FliPPeDround <734243792@qq.com> Date: Fri, 12 Apr 2024 17:56:48 +0800 Subject: [PATCH] =?UTF-8?q?feat=EF=BC=9Acatch=20error=20input?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/index.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/index.ts b/src/index.ts index 78ff6a5..ccefaa1 100644 --- a/src/index.ts +++ b/src/index.ts @@ -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' @@ -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('操作已取消')}`) + process.exit(0) })