From f53212fd8d9bf322bc80ffcce003e1c47ad85f06 Mon Sep 17 00:00:00 2001 From: jaw <2135326728@qq.com> Date: Tue, 7 Mar 2023 10:06:46 +0800 Subject: [PATCH] =?UTF-8?q?docs:=20=E8=A1=A5=E5=85=85=E6=B1=89=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/index.ts | 16 +++++++++++++--- src/utils/locales.ts | 6 ++++++ 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/src/index.ts b/src/index.ts index d65e362..36de40e 100644 --- a/src/index.ts +++ b/src/index.ts @@ -6,7 +6,7 @@ import locales from './utils/locales' import { transformStart } from './transformStart' const runTransform = async () => { - const { scanPath, isGitMv } = await prompts([ + const { scanPath, isGitMv, lang = 'zh' } = await prompts([ { type: 'select', name: 'lang', @@ -41,10 +41,20 @@ const runTransform = async () => { const needTransformList = await transformStart(scanPath.trim(), isGitMv) if (needTransformList.length > 0) { - consola.success(`Finish ${green('to jsx')}`) + consola.success(`${locales[lang].finish} ${green('to jsx')}`) + + const { show = false } = await prompts({ + name: 'show', + type: 'confirm', + message: `${locales[lang].show}?`, + initial: false, + }) as { show?: boolean } + + if (show) + needTransformList.forEach(item => consola.log(item)) } else { - consola.info('No files found to be migrated') + consola.info(locales[lang].noFiles) } } diff --git a/src/utils/locales.ts b/src/utils/locales.ts index ef7ae5f..7692d69 100644 --- a/src/utils/locales.ts +++ b/src/utils/locales.ts @@ -1,10 +1,16 @@ export default { zh: { scanPath: '请指定需要扫描的文件夹', + show: '是否展示修改结果', + noFiles: '未发现有需要迁移的文件', + finish: '完成', isGitMv: '是否使用Git mv方式进行批量修改后缀名(Git托管的项目推荐这种方式)', }, en: { scanPath: 'Please specify the folder to be scanned', + show: 'Display modification results', + noFiles: 'No files found to be migrated', + finish: 'Finish', isGitMv: 'Whether to use Git mv method to batch modify suffix names (Git managed projects recommend this method)', }, }