diff --git a/dist/index.js b/dist/index.js index ff750ac0..e0cc5365 100644 --- a/dist/index.js +++ b/dist/index.js @@ -32873,10 +32873,14 @@ exports.runCommand = runCommand; const buildComment = async (response, label, outputStr, problemsCount) => { if (response.error == true) { if (problemsCount !== undefined && problemsCount > 0) { - response.output = `${exports.failedEmoji} - ${label}: ${problemsCount} problem${problemsCount > 1 ? "s" : ""} found\n
See Details${outputStr}
`; + // response.output = `${failedEmoji} - ${label}: ${problemsCount} problem${ + // problemsCount > 1 ? "s" : "" + // } found\n
See Details${outputStr}
`; + response.output = `${exports.failedEmoji} -
${label}: ${problemsCount} problem${problemsCount > 1 ? "s" : ""}${outputStr}
\n`; } else { - response.output = `${exports.failedEmoji} - ${label}\n
See Details${outputStr}
`; + // response.output = `${failedEmoji} - ${label}\n
See Details${outputStr}
`; + response.output = `${exports.failedEmoji} -
${label}${outputStr}
\n`; } } else { @@ -32987,6 +32991,12 @@ async function run() { command: "npx lit-analyzer --quiet --format markdown", }) : undefined; + const typeDocStr = doStaticAnalysis + ? await (0, analyze_1.typeDoc)({ + label: "TypeDoc", + command: "npx typedoc --logLevel Warn", + }) + : undefined; let webComponentsSrcRoot = wcSrcDirectory.split("/").shift(); if (webComponentsSrcRoot?.isEmpty()) { webComponentsSrcRoot = wcSrcDirectory.split("/")[1]; @@ -33024,12 +33034,6 @@ async function run() { const coverageStr = runCoverage ? await (0, coverage_1.coverage)(pastCoverageScore, currentCoverageScore, coveragePassScore, coveragePath) : undefined; - const typeDocStr = doTests - ? await (0, testing_1.typeDoc)({ - label: "TypeDoc", - command: "npx typedoc --logLevel Warn", - }) - : undefined; const [checkModifiedFilesStr, modified] = await (0, post_1.checkModifiedFiles)({ label: "Check for modified files", command: "git status --porcelain", @@ -33069,8 +33073,10 @@ async function run() { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.litAnalyzer = exports.eslint = void 0; +exports.typeDoc = exports.litAnalyzer = exports.eslint = void 0; const main_1 = __nccwpck_require__(1730); +const exec_1 = __nccwpck_require__(5236); +const core_1 = __nccwpck_require__(7484); const eslint = async (command) => { const [response, outputStr] = await (0, main_1.runCommand)(command); const lines = outputStr.split("\n"); @@ -33111,6 +33117,49 @@ const litAnalyzer = async (command) => { } }; exports.litAnalyzer = litAnalyzer; +const typeDoc = async (command) => { + let response = { output: "", error: false }; + let commandOutput = ""; + try { + await (0, exec_1.exec)(command.command, [], { + listeners: { + stderr: (data) => { + commandOutput += data.toString(); + }, + }, + }); + } + catch (error) { + response.error = true; + (0, core_1.setFailed)(`Failed ${command.label}: ${error}`); + } + let outputStr = ""; + let problemCount = 0; + if (response.error) { + commandOutput = commandOutput.replace(/\[\d+m/g, ""); + const lines = commandOutput.split("\n"); + const table = lines + .map((line) => { + const match = line.match(/^(.*):(\d+):(\d+) - (.*)/); + if (match) { + const [_, file, line, column, message] = match; + return `${file}${line}${column}${message}`; + } + return ""; + }) + .join(""); + outputStr = `${table}
FileLineColumnMessage
`; + lines.forEach((line) => { + const match = line.match(/Found (\d+) errors and (\d+) warnings/); + if (match) { + const [_, errors, warnings] = match; + problemCount += parseInt(errors) + parseInt(warnings); + } + }); + } + return await (0, main_1.buildComment)(response, command.label, outputStr, problemCount); +}; +exports.typeDoc = typeDoc; /***/ }), @@ -33123,6 +33172,27 @@ exports.litAnalyzer = litAnalyzer; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.comment = void 0; const core_1 = __nccwpck_require__(7484); +const main_1 = __nccwpck_require__(1730); +const group = (name, steps, showOnPass) => { + const isError = steps.some((step) => step.error); + let message = "
  • "; + if (isError) { + message += `${main_1.failedEmoji}
    ${name}`; + for (const step in steps) { + message += ` - ${steps[step].output}\n`; + } + message += "
    "; + } + else if (showOnPass) { + message = `${main_1.passedEmoji} - ${name}\n`; + } + else { + message = ""; + } + if (message.length > 0) + message += "
  • "; + return message; +}; const li = (str) => { return `
  • @@ -33132,9 +33202,36 @@ const li = (str) => { }; const comment = async (ocotokit, context, npmIStr, cemStr, eslintStr, litAnalyzerStr, prettierStr, playwrightStr, testingStr, coverageStr, typeDocStr, checkModifiedFilesStr, updateChangesStr) => { try { + let setup = []; + let analysis = []; + let formatting = []; + let testing = []; + let postChecks = []; + if (npmIStr !== undefined) + setup.push(npmIStr); + if (cemStr !== undefined) + setup.push(cemStr); + if (eslintStr !== undefined) + analysis.push(eslintStr); + if (litAnalyzerStr !== undefined) + analysis.push(litAnalyzerStr); + if (typeDocStr !== undefined) + analysis.push(typeDocStr); + if (prettierStr !== undefined) + formatting.push(prettierStr); + if (playwrightStr !== undefined) + testing.push(playwrightStr); + if (testingStr !== undefined) + testing.push(testingStr); + if (coverageStr !== undefined) + testing.push(coverageStr); + if (checkModifiedFilesStr !== undefined) + postChecks.push(checkModifiedFilesStr); + if (updateChangesStr !== undefined) + postChecks.push(updateChangesStr); const commentBody = ` - ## PR Checks Complete\n -