- Removed obsolete test script `test_crawl4ai_fit_markdown.py`. - Deleted `verify-package-main-obfuscation.mjs` as it is no longer needed. - Updated paths in `app-update-publish-config.test.ts` to reflect new script locations. - Refactored `package-content-policy.test.ts` to use new paths for content policy scripts. - Adjusted `package-main-obfuscation.test.ts` to point to the new obfuscation script locations. - Modified `package-size-budget.test.ts` to use updated paths for size budget scripts. - Changed `r2-update-metadata-contract.test.ts` to reference the new metadata script. - Updated `release-fragment-contract.test.ts` to use the new fragment contract script. - Refactored `release-storage-layout.test.ts` to point to the new storage layout script. - Added `runtime-trace.test.ts` to test runtime tracing functionality. - Updated `node-pty-native-release.test.ts` to reflect new paths for native release scripts.
38 lines
1.7 KiB
JavaScript
38 lines
1.7 KiB
JavaScript
import fs from 'node:fs'
|
|
import path from 'node:path'
|
|
|
|
const reportPath = path.resolve(process.argv[2] || 'dist/package-audit.json')
|
|
const report = JSON.parse(fs.readFileSync(reportPath, 'utf8'))
|
|
const formatSize = (bytes) => `${(Number(bytes || 0) / 1024 / 1024).toFixed(1)} MiB`
|
|
|
|
process.stdout.write('## Package security audit\n\n')
|
|
process.stdout.write(`Platform: ${report.platform}-${report.arch}\n\n`)
|
|
process.stdout.write('| Type | Name | Size |\n| --- | --- | ---: |\n')
|
|
for (const application of report.applications || []) {
|
|
process.stdout.write(
|
|
`| Installed app | ${application.root} | ${formatSize(application.totalBytes)} |\n`
|
|
)
|
|
process.stdout.write(
|
|
`| app.asar | ${application.archive} | ${formatSize(application.archiveBytes)} |\n`
|
|
)
|
|
}
|
|
for (const installer of report.installers || []) {
|
|
process.stdout.write(
|
|
`| Installer/update | ${installer.name} | ${formatSize(installer.bytes)} |\n`
|
|
)
|
|
}
|
|
process.stdout.write('\nThe source, secret and forbidden-file audit passed.\n')
|
|
if (!report.sizeBudget || report.sizeBudget.status === 'not-configured') {
|
|
process.stdout.write('Numeric size budgets are not configured for this platform.\n')
|
|
} else {
|
|
process.stdout.write(`\n## Package size budget: ${report.sizeBudget.status}\n\n`)
|
|
process.stdout.write('| Item | Current | Baseline | Growth | Hard limit | Status |\n')
|
|
process.stdout.write('| --- | ---: | ---: | ---: | ---: | --- |\n')
|
|
for (const metric of report.sizeBudget.metrics || []) {
|
|
process.stdout.write(
|
|
`| ${metric.label} | ${formatSize(metric.actualBytes)} | ${formatSize(metric.baselineBytes)} | ` +
|
|
`${Number(metric.growthPercent).toFixed(1)}% | ${formatSize(metric.hardLimitBytes)} | ${metric.status} |\n`
|
|
)
|
|
}
|
|
}
|