@@ -100,12 +100,16 @@ See extended [examples].
100
100
const cdx = require (' @cyclonedx/cyclonedx-library' )
101
101
102
102
const bom = new cdx.Models.Bom ()
103
- bom .components .add (
104
- new cdx.Models.Component (
105
- cdx .Enums .ComponentType .Library ,
106
- ' myComponent'
107
- )
103
+ bom .metadata .component = new cdx.Models.Component (
104
+ cdx .Enums .ComponentType .Application ,
105
+ ' MyProject'
108
106
)
107
+ const componentA = new cdx.Models.Component (
108
+ cdx .Enums .ComponentType .Library ,
109
+ ' myComponentA' ,
110
+ )
111
+ bom .components .add (componentA)
112
+ bom .metadata .component .dependencies .add (componentA .bomRef )
109
113
```
110
114
111
115
### In _ WebBrowsers_
@@ -118,12 +122,16 @@ bom.components.add(
118
122
const cdx = CycloneDX_library
119
123
120
124
let bom = new cdx.Models.Bom ()
121
- bom .components .add (
122
- new cdx.Models.Component (
123
- cdx .Enums .ComponentType .Library ,
124
- ' myComponent'
125
- )
125
+ bom .metadata .component = new cdx.Models.Component (
126
+ cdx .Enums .ComponentType .Application ,
127
+ ' MyProject'
128
+ )
129
+ const componentA = new cdx.Models.Component (
130
+ cdx .Enums .ComponentType .Library ,
131
+ ' myComponentA' ,
126
132
)
133
+ bom .components .add (componentA)
134
+ bom .metadata .component .dependencies .add (componentA .bomRef )
127
135
</script >
128
136
```
129
137
@@ -141,7 +149,7 @@ See the [LICENSE][license_file] file for the full license.
141
149
142
150
[ license_file ] : https://github.com/CycloneDX/cyclonedx-javascript-library/blob/main/LICENSE
143
151
[ contributing_file ] : https://github.com/CycloneDX/cyclonedx-javascript-library/blob/main/CONTRIBUTING.md
144
- [ examples ] : https://github.com/CycloneDX/cyclonedx-javascript-library/tree/main/examples
152
+ [ examples ] : https://github.com/CycloneDX/cyclonedx-javascript-library/tree/main/examples/README.md
145
153
146
154
[ shield_gh-workflow-test ] : https://img.shields.io/github/workflow/status/CycloneDX/cyclonedx-javascript-library/Node%20CI/main?logo=GitHub&logoColor=white " tests "
147
155
[ shield_npm-version ] : https://img.shields.io/npm/v/%40cyclonedx/cyclonedx-library?logo=npm&logoColor=white " npm "
0 commit comments