Authored by 毕凯

在执行检查脚本的时候,不显示 NPM 错误日志

Showing 1 changed file with 5 additions and 0 deletions
@@ -16,6 +16,11 @@ const lintResult = { @@ -16,6 +16,11 @@ const lintResult = {
16 16
17 const ext = process.platform === 'win32' ? '.cmd' : ''; // Windows 平台需要加后缀 17 const ext = process.platform === 'win32' ? '.cmd' : ''; // Windows 平台需要加后缀
18 18
  19 +// 在执行检查脚本的时候,不显示 NPM 错误日志
  20 +if (!shelljs.grep('npm run -s', path.resolve('./.git/hooks/pre-commit')).stdout.trim()) {
  21 + shelljs.sed('-i', 'npm run', 'npm run -s', path.resolve('./.git/hooks/pre-commit'));
  22 +}
  23 +
19 if (changeFiles.js) { 24 if (changeFiles.js) {
20 changeFiles.js = changeFiles.js.replace(/\n/g, ' '); 25 changeFiles.js = changeFiles.js.replace(/\n/g, ' ');
21 lintResult.js = shelljs.exec(`${lintPath.js}${ext} -c .eslintrc --cache --fix ${changeFiles.js}`); 26 lintResult.js = shelljs.exec(`${lintPath.js}${ext} -c .eslintrc --cache --fix ${changeFiles.js}`);