@@ -100,12 +100,16 @@ See extended [examples].
100100const cdx = require (' @cyclonedx/cyclonedx-library' )
101101
102102const 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'
108106)
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 )
109113```
110114
111115### In _ WebBrowsers_
@@ -118,12 +122,16 @@ bom.components.add(
118122 const cdx = CycloneDX_library
119123
120124 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' ,
126132 )
133+ bom .components .add (componentA)
134+ bom .metadata .component .dependencies .add (componentA .bomRef )
127135 </script >
128136```
129137
@@ -141,7 +149,7 @@ See the [LICENSE][license_file] file for the full license.
141149
142150[ license_file ] : https://github.com/CycloneDX/cyclonedx-javascript-library/blob/main/LICENSE
143151[ 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
145153
146154[ shield_gh-workflow-test ] : https://img.shields.io/github/workflow/status/CycloneDX/cyclonedx-javascript-library/Node%20CI/main?logo=GitHub&logoColor=white " tests "
147155[ shield_npm-version ] : https://img.shields.io/npm/v/%40cyclonedx/cyclonedx-library?logo=npm&logoColor=white " npm "
0 commit comments