mirror of
https://github.com/hansjone/oclaw.git
synced 2026-10-12 22:30:51 +08:00
Ignore pnpm metadata in SBOM generation
This commit is contained in:
parent
2eb168442e
commit
b744483fcd
1 changed files with 6 additions and 1 deletions
|
|
@ -5,7 +5,12 @@ const root = resolve(import.meta.dirname, '..')
|
|||
const pkg = JSON.parse(await readFile(join(root, 'package.json'), 'utf8'))
|
||||
const lock = JSON.parse(await readFile(join(root, 'package-lock.json'), 'utf8'))
|
||||
const bundle = await readFile(join(root, 'lib/qrcode-bundled.cjs'))
|
||||
const sourceFiles = [...bundle.toString().matchAll(/^\/\/ node_modules\/(.+)$/gm)].map(m => m[1].trim())
|
||||
// Bun can emit pnpm's virtual-store metadata (node_modules/.pnpm/package.json)
|
||||
// in its source comments. It is not bundled application code and is not a
|
||||
// dependency component, so exclude it from the SBOM source inventory.
|
||||
const sourceFiles = [...bundle.toString().matchAll(/^\/\/ node_modules\/(.+)$/gm)]
|
||||
.map(m => m[1].trim())
|
||||
.filter(path => path !== '.pnpm/package.json')
|
||||
if (!sourceFiles.length) throw new Error('bundle source inventory missing')
|
||||
const names = [...new Set(sourceFiles.map(path => path.startsWith('@') ? path.split('/').slice(0, 2).join('/') : path.split('/')[0]))].sort()
|
||||
const components = [], notices = []
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue