Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: pluggable optional deps funcs centralized #1084

Merged
merged 45 commits into from
Jun 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
1596a82
refactor: convert to TS
jkowalleck Jun 4, 2024
6168be2
migrate pluggable xml validator
jkowalleck Jun 4, 2024
f683ad0
wip
jkowalleck Jun 4, 2024
0cabf9e
wip
jkowalleck Jun 4, 2024
f436e4b
wip
jkowalleck Jun 4, 2024
58be395
wip
jkowalleck Jun 4, 2024
01a9cbf
docs
jkowalleck Jun 4, 2024
e1cbc79
wip
jkowalleck Jun 5, 2024
15e1aa3
fix json schema 1.2
jkowalleck Jun 5, 2024
9135e7b
wip
jkowalleck Jun 5, 2024
a23c597
wip
jkowalleck Jun 5, 2024
7f60354
wip
jkowalleck Jun 5, 2024
ecbddce
docs
jkowalleck Jun 5, 2024
2ef6d30
refactor
jkowalleck Jun 5, 2024
aa0798e
tidy
jkowalleck Jun 5, 2024
d26a611
tidy
jkowalleck Jun 5, 2024
3d30e5e
tidy
jkowalleck Jun 5, 2024
ba8da8b
fix
jkowalleck Jun 5, 2024
8ea81d6
tests
jkowalleck Jun 5, 2024
a571fa6
tests
jkowalleck Jun 5, 2024
a725e8f
tests
jkowalleck Jun 5, 2024
640f3c7
ci
jkowalleck Jun 5, 2024
ab3972a
ci
jkowalleck Jun 5, 2024
a6b6feb
ci
jkowalleck Jun 5, 2024
e463121
dings
jkowalleck Jun 5, 2024
87116f9
tidy
jkowalleck Jun 5, 2024
e10e52c
ci
jkowalleck Jun 5, 2024
e0103c4
ci
jkowalleck Jun 5, 2024
441bdc9
ci
jkowalleck Jun 5, 2024
fed8af0
tests
jkowalleck Jun 5, 2024
6f0b285
tests
jkowalleck Jun 5, 2024
ee7c22e
tests
jkowalleck Jun 5, 2024
c08e1c5
fix
jkowalleck Jun 5, 2024
c1136d3
fix
jkowalleck Jun 5, 2024
2ed07ab
types
jkowalleck Jun 5, 2024
e867191
docs
jkowalleck Jun 5, 2024
7ba6c80
docs
jkowalleck Jun 5, 2024
4d8ead5
docs
jkowalleck Jun 5, 2024
6366556
docs
jkowalleck Jun 5, 2024
0d71a47
types
jkowalleck Jun 5, 2024
c3a7dec
tidy
jkowalleck Jun 5, 2024
ec95498
tidy
jkowalleck Jun 5, 2024
36cbb6d
tidy
jkowalleck Jun 6, 2024
528c0a2
tidy
jkowalleck Jun 6, 2024
359b5b5
tidy
jkowalleck Jun 6, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions .c8rc.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
{
"all": true,
"src": [
"src",
"libs/universal-node-xml"
"src"
],
"exclude": [
"**/*.web.ts",
Expand Down
1 change: 0 additions & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
/res/schema/

!/src/**
!/libs/**

!/tools/schema-downloader/**

Expand Down
8 changes: 6 additions & 2 deletions .github/workflows/nodejs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -152,12 +152,14 @@ jobs:
# do not use caching, use fresh version always, since some deps are not pinned -- since this is a library.
- name: setup project
shell: bash
env:
NODE_VERSION: '${{ matrix.node-version }}'
run: |
set -ex
dep_constraints=''
dev_requirements='c8 mocha npm-run-all fast-glob'
# as long as npm cannot auto-resolve engine-constraints, we need to help here
case '${{ matrix.node-version }}' in
case "$NODE_VERSION" in
'16')
# for some stupid reason, NPM tries to resolve dev-packages, event hey are to be omitted.
# this is frustrating when NPM is not resolving to compatible versions ...so drop them here
Expand All @@ -184,7 +186,9 @@ jobs:
name: dist.node
path: dist.node
- name: test
run: npm run test:node
run: >
npm run -- test:node
${{ startsWith(matrix.node-version, env.NODE_ACTIVE_LTS) && ' --forbid-pending' || '' }}
- name: collect coverage
if: ${{ failure() || success() }}
run: >
Expand Down
3 changes: 1 addition & 2 deletions .mocharc.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@ Copyright (c) OWASP Foundation. All Rights Reserved.
module.exports = {
timeout: 10000,
spec: [
'tests',
'libs'
'tests'
],
recursive: true,
parallel: false, // if true, then some IDEs cannot run it
Expand Down
13 changes: 13 additions & 0 deletions HISTORY.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,19 @@ All notable changes to this project will be documented in this file.

<!-- add unreleased items here -->

* Changed
* Exising `Serialize.XmlSerializer.serialize()` for _Node.js_ may throw `Serialize.MissingOptionalDependencyError` (via [#1084])
This is considered a non-breaking change, as the docs always told that any `Error` may be thrown.
* Added
* New class `Serialize.MissingOptionalDependencyError` (via [#1084])
* Misc
* Refactored functionality around optional/pluggable dependencies (via [#1083], [#1084])
This was done in preparation for [#1079]

[#1079]: https://github.com/CycloneDX/cyclonedx-javascript-library/issues/1079
[#1083]: https://github.com/CycloneDX/cyclonedx-javascript-library/pull/1083
[#1084]: https://github.com/CycloneDX/cyclonedx-javascript-library/pull/1084

## 6.9.5 -- 2024-05-23

Maintenance release.
Expand Down
129 changes: 0 additions & 129 deletions libs/universal-node-xml/__stringifiers/xmlbuilder2.spec.js

This file was deleted.

52 changes: 0 additions & 52 deletions libs/universal-node-xml/stringify.js

This file was deleted.

15 changes: 8 additions & 7 deletions res/schema/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@ Currently using version
| [`bom-1.4.SNAPSHOT.xsd`](bom-1.4.SNAPSHOT.xsd) | applied changes: 1 |
| [`bom-1.5.SNAPSHOT.xsd`](bom-1.5.SNAPSHOT.xsd) | applied changes: 1 |
| [`bom-1.6.SNAPSHOT.xsd`](bom-1.6.SNAPSHOT.xsd) | applied changes: 1 |
| [`bom-1.2.SNAPSHOT.schema.json`](bom-1.2.SNAPSHOT.schema.json) | applied changes: 2,3,4,5 |
| [`bom-1.3.SNAPSHOT.schema.json`](bom-1.3.SNAPSHOT.schema.json) | applied changes: 2,3,4,5 |
| [`bom-1.4.SNAPSHOT.schema.json`](bom-1.4.SNAPSHOT.schema.json) | applied changes: 2,3,4,5 |
| [`bom-1.5.SNAPSHOT.schema.json`](bom-1.5.SNAPSHOT.schema.json) | applied changes: 2,3,4,5 |
| [`bom-1.6.SNAPSHOT.schema.json`](bom-1.6.SNAPSHOT.schema.json) | applied changes: 2,3,4,5 |
| [`bom-1.2-strict.SNAPSHOT.schema.json`](bom-1.2-strict.SNAPSHOT.schema.json) | applied changes: 2,3,4,5 |
| [`bom-1.3-strict.SNAPSHOT.schema.json`](bom-1.3-strict.SNAPSHOT.schema.json) | applied changes: 2,3,4,5 |
| [`bom-1.2.SNAPSHOT.schema.json`](bom-1.2.SNAPSHOT.schema.json) | applied changes: 2,3,4,5,6 |
| [`bom-1.3.SNAPSHOT.schema.json`](bom-1.3.SNAPSHOT.schema.json) | applied changes: 2,3,4,5,6 |
| [`bom-1.4.SNAPSHOT.schema.json`](bom-1.4.SNAPSHOT.schema.json) | applied changes: 2,3,4,5,6 |
| [`bom-1.5.SNAPSHOT.schema.json`](bom-1.5.SNAPSHOT.schema.json) | applied changes: 2,3,4,5,6 |
| [`bom-1.6.SNAPSHOT.schema.json`](bom-1.6.SNAPSHOT.schema.json) | applied changes: 2,3,4,5,6 |
| [`bom-1.2-strict.SNAPSHOT.schema.json`](bom-1.2-strict.SNAPSHOT.schema.json) | applied changes: 2,3,4,5,6 |
| [`bom-1.3-strict.SNAPSHOT.schema.json`](bom-1.3-strict.SNAPSHOT.schema.json) | applied changes: 2,3,4,5,6 |
| [`spdx.SNAPSHOT.xsd`](spdx.SNAPSHOT.xsd) | |
| [`spdx.SNAPSHOT.schema.json`](spdx.SNAPSHOT.schema.json) | |
| [`jsf-0.82.SNAPSHOT.schema.json`](jsf-0.82.SNAPSHOT.schema.json) | |
Expand All @@ -32,3 +32,4 @@ changes:
3. `jsf-0.82.schema.json` was replaced with `jsf-0.82.SNAPSHOT.schema.json`
4. `properties.$schema.enum` was fixed to match `$id`
5. `required.version` removed, as it is actually optional with default value
6. `"format": "string"` removed, as it is unknown to JSON spec
3 changes: 0 additions & 3 deletions res/schema/bom-1.2-strict.SNAPSHOT.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -135,19 +135,16 @@
"properties": {
"vendor": {
"type": "string",
"format": "string",
"title": "Tool Vendor",
"description": "The date and time (timestamp) when the document was created."
},
"name": {
"type": "string",
"format": "string",
"title": "Tool Name",
"description": "The date and time (timestamp) when the document was created."
},
"version": {
"type": "string",
"format": "string",
"title": "Tool Version",
"description": "The date and time (timestamp) when the document was created."
},
Expand Down
4 changes: 0 additions & 4 deletions res/schema/bom-1.2.SNAPSHOT.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -129,19 +129,16 @@
"properties": {
"vendor": {
"type": "string",
"format": "string",
"title": "Tool Vendor",
"description": "The date and time (timestamp) when the document was created."
},
"name": {
"type": "string",
"format": "string",
"title": "Tool Name",
"description": "The date and time (timestamp) when the document was created."
},
"version": {
"type": "string",
"format": "string",
"title": "Tool Version",
"description": "The date and time (timestamp) when the document was created."
},
Expand Down Expand Up @@ -837,7 +834,6 @@
"properties": {
"ref": {
"$ref": "#/definitions/refType",
"format": "string",
"title": "Reference",
"description": "References a component by the components bom-ref attribute"
},
Expand Down
4 changes: 2 additions & 2 deletions src/_helpers/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@

These are _internal_ helpers, that are not intended to be exported/published.

The helpers shall **not** be marked as `@internal`, so that TypeScript might pick up on them and still render definitions for them.
The internal defined interfaces, classes, functions are required for proper type checking downstream, but should not be utilized/called downstream.
The helpers SHALL **NOT** be marked as `@internal`, so that TypeScript might pick up on them and still render definitions for them.
The internal defined interfaces, classes, functions are required for proper type checking downstream, but SHOULD NOT be utilized/called downstream.
11 changes: 11 additions & 0 deletions src/_optPlug.node/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Optional Pluggable for node

These are _internal_ helpers, that are not intended to be exported/published.

The helpers SHALL **NOT** be marked as `@internal`, so that TypeScript might pick up on them and still render definitions for them.
The internal defined interfaces, classes, functions are required for proper type checking downstream, but SHOULD NOT be utilized/called downstream.

Some functionality is private.
These exports **MUST** be marked as `@internal`.
Respective files **MUST NOT** export or declare any relevant types or symbols.
Respective files **MUST** be prefixed with double-underscore ("dunder" - `__`).
Loading
Loading