Skip to content

Commit 21dbe2f

Browse files
committed
refactor(ci): read package.json once in the audit runner
auditScripts() re-read the manifest the module body had already loaded.
1 parent e35f068 commit 21dbe2f

1 file changed

Lines changed: 2 additions & 4 deletions

File tree

scripts/run-audits.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,7 @@ interface AuditResult {
4040
output: string
4141
}
4242

43-
async function auditScripts(): Promise<string[]> {
44-
const manifest = await Bun.file(path.join(ROOT, 'package.json')).json()
45-
const scripts = manifest.scripts as Record<string, string>
43+
function auditScripts(scripts: Record<string, string>): string[] {
4644
const derived = Object.keys(scripts).filter(
4745
(name) => name.startsWith('check:') && !(name in EXCLUDED)
4846
)
@@ -79,7 +77,7 @@ async function runAudit(script: string, command: string): Promise<AuditResult> {
7977

8078
const manifest = await Bun.file(path.join(ROOT, 'package.json')).json()
8179
const commands = manifest.scripts as Record<string, string>
82-
const queue = await auditScripts()
80+
const queue = auditScripts(commands)
8381
const total = queue.length
8482
// The coordinator only awaits, so it does not need a core reserved for it.
8583
const workers = Math.min(Math.max(2, navigator.hardwareConcurrency), total)

0 commit comments

Comments
 (0)