Skip to content

Commit 312add1

Browse files
GauBenjkowalleck
andauthored
feat!: give downstream users control over optional dependencies (#1295)
fixes #1294 --------- Signed-off-by: Gautier Ben Aïm <[email protected]> Signed-off-by: Jan Kowalleck <[email protected]> Co-authored-by: Jan Kowalleck <[email protected]>
1 parent 9e3b2e3 commit 312add1

File tree

16 files changed

+81
-3
lines changed

16 files changed

+81
-3
lines changed

HISTORY.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,14 @@ All notable changes to this project will be documented in this file.
66

77
<!-- add unreleased items here -->
88

9+
* BREAKING Changes
10+
* Optional dependencies became optional peer dependencies (via [#1295])
11+
* Added
12+
* Give downstream users control over optional dependencies ([#1294] via [#1295])
13+
14+
[#1294]: https://github.com/CycloneDX/cyclonedx-javascript-library/issues/1294
15+
[#1295]: https://github.com/CycloneDX/cyclonedx-javascript-library/pull/1295
16+
917
## 8.6.0 -- 2025-09-09
1018

1119
* Changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,9 +120,9 @@ pnpm add github:CycloneDX/cyclonedx-javascript-library
120120
yarn add @cyclonedx/cyclonedx-library@github:CycloneDX/cyclonedx-javascript-library # only with yarn-2
121121
```
122122

123-
## Optional Dependencies
123+
## Optional Peer Dependencies
124124

125-
Some dependencies are optional.
125+
Some peer dependencies are optional.
126126
See the shipped `package.json` for version constraints.
127127

128128
* Serialization to XML on _Node.js_ requires any of:

examples/node/javascript/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@
33
!/example.mjs
44
!/example.cjs
55
!/package.json
6+
!/.npmrc

examples/node/javascript/.npmrc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
; see the docs: https://docs.npmjs.com/cli/v11/using-npm/config
2+
3+
; our lib has some peer deps that need to be installed.
4+
; due to how node module resolution works, we must not install the lib as a symlink!
5+
install-links=true

examples/node/javascript/package.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,11 @@
55
"dependencies": {
66
"@cyclonedx/cyclonedx-library": "file:../../..",
77
"xmlbuilder2": "^3.0.2"
8+
},
9+
"optionalDependencies": {
10+
"ajv": "^8.12.0",
11+
"ajv-formats": "^3.0.1",
12+
"ajv-formats-draft2019": "^1.6.1",
13+
"libxmljs2": "^0.35||^0.37"
814
}
915
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
*
22
!/.gitignore
33
!/package.json
4+
!/.npmrc
45
!/tsconfig.json
56
!/src
67
!/src/**
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
; see the docs: https://docs.npmjs.com/cli/v11/using-npm/config
2+
3+
; our lib has some peer deps that need to be installed.
4+
; due to how node module resolution works, we must not install the lib as a symlink!
5+
install-links=true

examples/node/typescript/example.cjs/package.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,12 @@
77
"@cyclonedx/cyclonedx-library": "file:../../../..",
88
"xmlbuilder2": "^3.0.2"
99
},
10+
"optionalDependencies": {
11+
"ajv": "^8.12.0",
12+
"ajv-formats": "^3.0.1",
13+
"ajv-formats-draft2019": "^1.6.1",
14+
"libxmljs2": "^0.35||^0.37"
15+
},
1016
"devDependencies": {
1117
"@types/node": "*",
1218
"typescript": "^3.8 || ^4 || ^5"

examples/node/typescript/example.mjs/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
*
22
!/.gitignore
3+
!/.npmrc
34
!/package.json
45
!/tsconfig.json
56
!/src
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
; see the docs: https://docs.npmjs.com/cli/v11/using-npm/config
2+
3+
; our lib has some peer deps that need to be installed.
4+
; due to how node module resolution works, we must not install the lib as a symlink!
5+
install-links=true

0 commit comments

Comments
 (0)