Skip to content

Commit

Permalink
fix(set-project): 生成文件prettier命令错误捕获
Browse files Browse the repository at this point in the history
  • Loading branch information
StreakingMan committed Jul 7, 2022
1 parent 53b0bb9 commit 5ad4d92
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions utils/file-generator.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 命令失败');
}
}
};

Expand Down

0 comments on commit 5ad4d92

Please sign in to comment.