From b04ff741ce92745c2b7f551501a6ab7fe12708c0 Mon Sep 17 00:00:00 2001 From: Liu Date: Thu, 28 Jul 2022 04:06:31 +0800 Subject: [PATCH 1/3] =?UTF-8?q?fix(report):=20=E8=BF=90=E8=A1=8C=20webpack?= =?UTF-8?q?=20=E6=97=B6=E6=9C=AA=E6=A3=80=E6=B5=8B=E5=88=B0=E8=BF=9B?= =?UTF-8?q?=E7=A8=8B=20id?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bin/keepfast-report.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/bin/keepfast-report.js b/bin/keepfast-report.js index 26e0051..2ce402f 100644 --- a/bin/keepfast-report.js +++ b/bin/keepfast-report.js @@ -44,7 +44,7 @@ function parseBuildReportFile(file) { } } -// 获取 vue-cli-service 进程 id +// 获取构建进程 id async function getBuildToolPid(config) { if (!config.tool) { throw new Error(`invalid tool name: ${config.tool}`) @@ -61,14 +61,14 @@ async function getBuildToolPid(config) { } psList().then((list) => { let proc = null - const cmd = `bin/${config.tool}` list.forEach((p) => { // 匹配: + // webpack // .bin/webpack // .bin/webpack --mode production // 不匹配: // .bin/webpack-dev-server - if (p.cmd.includes(`${cmd} `) || p.cmd.endsWith(cmd)) { + if (p.cmd.includes(`${config.tool} `) || p.cmd.endsWith(config.tool)) { // 新进程的 pid 比较大,所以该进程最有可能是目标进程 if (!proc || proc.pid < p.pid) { proc = p @@ -115,7 +115,7 @@ async function generateBuildReport(config) { maxMemoryUsage = Math.max(stats.memory, maxMemoryUsage) }) }, 1000) - }) + }).catch(reject) }) try { -- Gitee From 0b8b1a5566a31bfa37bfadaca6c1c69a623d09e8 Mon Sep 17 00:00:00 2001 From: Liu Date: Thu, 28 Jul 2022 04:07:15 +0800 Subject: [PATCH 2/3] =?UTF-8?q?chore:=20=E5=88=A0=E9=99=A4=E6=97=A7?= =?UTF-8?q?=E8=AF=84=E8=AE=BA=E6=97=B6=E5=A2=9E=E5=8A=A0=E6=97=A5=E5=BF=97?= =?UTF-8?q?=E8=BE=93=E5=87=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bin/keepfast-upload.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/bin/keepfast-upload.js b/bin/keepfast-upload.js index ba97e83..24f808a 100644 --- a/bin/keepfast-upload.js +++ b/bin/keepfast-upload.js @@ -41,7 +41,8 @@ async function uploadToCommit(config, report, commitSha) { const comment = commentsRes.data.find((item) => item.user.id === userRes.data.id) if (comment) { - return axios.patch(`${baseUrl}/comments/${comment.id}`, { body: report }) + console.log(`delete comment @${commitSha}/${comment.id}`) + await axios.delete(`${baseUrl}/comments/${comment.id}`, { body: report }) } return axios.post(commitCommentsUrl, { body: report }) } @@ -61,7 +62,8 @@ async function uploadToPullRequest(config, report, pull) { const comment = commentsRes.data.find((item) => item.user.id === userRes.data.id) if (comment) { - axios.delete(`${baseUrl}/comments/${comment.id}`) + console.log(`delete comment #${pull.number}/${comment.id}`) + await axios.delete(`${baseUrl}/comments/${comment.id}`) } return axios.post(pullCommentsUrl, { body: report }) } -- Gitee From 769315f153405dcf92d80457ca1e1be8d5f3933d Mon Sep 17 00:00:00 2001 From: Liu Date: Thu, 28 Jul 2022 14:09:31 +0800 Subject: [PATCH 3/3] =?UTF-8?q?fixup!=20fix(report):=20=E8=BF=90=E8=A1=8C?= =?UTF-8?q?=20webpack=20=E6=97=B6=E6=9C=AA=E6=A3=80=E6=B5=8B=E5=88=B0?= =?UTF-8?q?=E8=BF=9B=E7=A8=8B=20id?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bin/keepfast-report.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/bin/keepfast-report.js b/bin/keepfast-report.js index 2ce402f..df7cb62 100644 --- a/bin/keepfast-report.js +++ b/bin/keepfast-report.js @@ -64,11 +64,12 @@ async function getBuildToolPid(config) { list.forEach((p) => { // 匹配: // webpack + // webpack --mode production // .bin/webpack // .bin/webpack --mode production // 不匹配: // .bin/webpack-dev-server - if (p.cmd.includes(`${config.tool} `) || p.cmd.endsWith(config.tool)) { + if (p.cmd.split(' ').some((cmd) => cmd.endsWith(`.bin/${config.tool}`) || cmd === config.tool)) { // 新进程的 pid 比较大,所以该进程最有可能是目标进程 if (!proc || proc.pid < p.pid) { proc = p -- Gitee