From 5ad4d924a4641ccaa8a999ed1f2e9d1c371a98d7 Mon Sep 17 00:00:00 2001 From: streakingman Date: Thu, 7 Jul 2022 12:11:53 +0800 Subject: [PATCH] =?UTF-8?q?fix(set-project):=20=E7=94=9F=E6=88=90=E6=96=87?= =?UTF-8?q?=E4=BB=B6prettier=E5=91=BD=E4=BB=A4=E9=94=99=E8=AF=AF=E6=8D=95?= =?UTF-8?q?=E8=8E=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- utils/file-generator.js | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/utils/file-generator.js b/utils/file-generator.js index 0602e08..85da90d 100644 --- a/utils/file-generator.js +++ b/utils/file-generator.js @@ -79,9 +79,16 @@ const fileGenerator = ({ templateName, pathName = '/', option = {} }) => { filename.endsWith('.ts') || filename.endsWith('.tsx') ) { - execSync( - `prettier --write ${path.join(path.join(cwd, pathName), filename)}` - ); + try { + execSync( + `prettier --write ${path.join( + path.join(cwd, pathName), + filename + )}` + ); + } catch (e) { + console.warn('prettier 命令失败'); + } } };