Skip to content

Commit

Permalink
refactor: easier to have render-servers-table in mjs
Browse files Browse the repository at this point in the history
  • Loading branch information
enisdenjo committed Jul 6, 2023
1 parent e44dfac commit 066dd9c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/audits.yml
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ jobs:
with:
name: audit-reports
- name: Render servers table
run: yarn tsx scripts/render-servers-table.ts
run: node scripts/render-servers-table.mjs
- name: Diff
run: git diff --minimal
- name: Commit
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,14 @@ main().catch((err) => {
process.exit(1);
});

async function renderTable(implsDir: string) {
/** @param {string} implsDir */
async function renderTable(implsDir) {
let out = `<!-- prettier-ignore-start -->
| Name | Audit |
|------|-------|`;
for (const implDir of (await fs.readdir(implsDir)).sort()) {
const report: { error: number } = JSON.parse(
/** @type {{ error: number }} */
const report = JSON.parse(
(
await fs.readFile(path.join(implsDir, implDir, 'report.json'))
).toString(),
Expand All @@ -37,7 +39,8 @@ async function renderTable(implsDir: string) {
continue;
}

const pkg: Record<string, unknown> = JSON.parse(
/** @type {Record<string, unknown>} */
const pkg = JSON.parse(
(
await fs.readFile(path.join(implsDir, implDir, 'package.json'))
).toString(),
Expand Down

0 comments on commit 066dd9c

Please sign in to comment.