Skip to content

Commit

Permalink
Added status to the table
Browse files Browse the repository at this point in the history
  • Loading branch information
pabun committed Nov 6, 2023
1 parent 8310c32 commit 017ba11
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
6 changes: 5 additions & 1 deletion dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -14540,12 +14540,16 @@ const processNpm = (projectPath) => __awaiter(void 0, void 0, void 0, function*
});
// create detailed report
const { stdout: licenseReportDetailed } = yield exec.getExecOutput("npx", ["license-compliance@2", "--production", "--format", "json", "--report", "detailed"], { silent: true });
const tableData = JSON.parse(licenseReportDetailed).map(({ name, license }) => [name, license]);
const tableData = JSON.parse(licenseReportDetailed).map(({ name, version, license, repository }) => {
const status = blockedLicenses.includes(license) ? ":warning:" : ":white_check_mark:";
return [status, name, version, license, repository];
});
yield core.summary
.addHeading("NPM license Details for " + projectPath)
// .addCodeBlock(licenseReportDetailed, "text")
.addTable([
[
{ data: "Status", header: true },
{ data: "Name", header: true },
{ data: "Version", header: true },
{ data: "License", header: true },
Expand Down
6 changes: 5 additions & 1 deletion src/npmlicensecheck.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,17 @@ const processNpm = async (projectPath: string): Promise<string> => {
{ silent: true },
);

const tableData = (JSON.parse(licenseReportDetailed) as PackageEntry[]).map(({ name, license }) => [name, license]);
const tableData = (JSON.parse(licenseReportDetailed) as PackageEntry[]).map(({ name, version, license, repository }) => {
const status = blockedLicenses.includes(license) ? ":warning:" : ":white_check_mark:";
return [status, name, version, license, repository];
});

await core.summary
.addHeading("NPM license Details for " + projectPath)
// .addCodeBlock(licenseReportDetailed, "text")
.addTable([
[
{ data: "Status", header: true },
{ data: "Name", header: true },
{ data: "Version", header: true },
{ data: "License", header: true },
Expand Down

0 comments on commit 017ba11

Please sign in to comment.