feat: add npm engine constraint properties - #1507
Conversation
Populate CycloneDX npm taxonomy properties from package.json engine constraints and ignore malformed non-string values. Signed-off-by: CAOShurong <170531907+CAOShurong@users.noreply.github.com>
Up to standards ✅🟢 Issues
|
| Metric | Results |
|---|---|
| Duplication | 0 |
NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.
Documentation build overview
|
| import type { ExternalReferenceFactory } from './factories' | ||
| import type { NodePackageJson } from './types' | ||
|
|
||
| function makeEngineProperties (engines: unknown): PropertyRepository { |
There was a problem hiding this comment.
please move this inside the ComponentBuilder
| externalReferences: new ExternalReferenceRepository(externalReferences), | ||
| group, | ||
| licenses, | ||
| properties, |
| ) | ||
| ], | ||
| [ | ||
| 'ignore malformed engine constraints', |
There was a problem hiding this comment.
pleasse also adda test case where the malformed engines is an array, and one for where it is null, and one where it is a string.
Co-authored-by: Jan Kowalleck <jan.kowalleck@gmail.com> Signed-off-by: Jan Kowalleck <jan.kowalleck@gmail.com>
|
Both review requests are now in place at exact head
Verification on this head: 8 focused ComponentBuilder tests, 4,155 full node tests, Thanks for the review and for applying the HISTORY.md suggestion. |
…malformed engines Signed-off-by: CAOShurong <170531907+CAOShurong@users.noreply.github.com>
dee02ea to
e328805
Compare
Description
Populate
Component.propertiesfrom the string-valued entries in a Nodepackage manifest's
enginesobject. Each entry uses the existing CycloneDXnpm property taxonomy name
cdx:npm:package:constraint:engine:<name>.Malformed non-string engine constraints are ignored, consistent with the
builder's defensive handling of other package manifest fields.
Fixes issue: #1506
Verification
npm run test:node(4,166 passing)npm run test:lintnpm run test:standardnpm run test:dependenciesnpm run build:nodenpm run build:webnpx tsc -b ./tsconfig.d.jsonnpm pack --ignore-scripts, followed by installation into a clean directoryand runtime checks for valid constraints, malformed values, and a missing
package name
AI Tool Disclosure
OpenAI CodexGPT-5Inspect issue #1506 and the repository contribution rules; implement only the required npm engine constraint properties; add positive and malformed-input regression coverage; run build, lint, full tests, package, and clean-install runtime verification.Affirmation