Skip to content

Commit f0e5cc9

Browse files
authored
3.0.0 - rewrite in TS with CDX-lib (#70)
This is a reboot, written in _TypeScript_ and compiled to _JavaScript_. * BREAKING changes * Requires _Node.js_ `>= 14.0.0` now, was `>= 12.0.0`. * Requires _webpack_ version `^5` as a `peerDependency`, was `>=4 <6`. * Changed: * The optional configuration options changed in name and meaning. Consult the `README` for details. * Added * Added an optional switch to select the desired CycloneDX spec version for the output. The value currently defaults to `'1.4'`. (fixes [#53] via [#70]) * Full support for typing. This will make the configuration of this plugin easier. * Lots of small features got added due to the fact that the data processing is managed by `@cyclonedx/cyclonedx-library` now. * Fixed * Dependency graph no longer has `null` or `undefined` values. (fixes [#31] via [#70]) * Removed * The optional config option `emitStats` and its functionality were dropped. You may use _webpack_'s `--stats` switch instead. * Misc * Uses `@cyclonedx/cyclonedx-library` now, instead of `@cyclonedx/bom`. [#31]: #31 [#53]: #53 [#70]: #70 Signed-off-by: Jan Kowalleck <[email protected]>
1 parent 7c2e1a2 commit f0e5cc9

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+22509
-32200
lines changed

.editorconfig

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# EditorConfig is awesome: https://EditorConfig.org
2+
3+
root = true
4+
5+
[*]
6+
end_of_line = lf
7+
insert_final_newline = true
8+
9+
[*.md]
10+
# trailing white spaces are used for linebreaks in paragraphs.
11+
trim_trailing_whitespace = false
12+
13+
[*.{ts,js,cjs,mjs}]
14+
charset = utf-8
15+
end_of_line = lf
16+
indent_style = space
17+
indent_size = 2
18+
trim_trailing_whitespace = true
19+
insert_final_newline = true
20+
21+
[*.{json,cjson,cjsn}]
22+
charset = utf-8
23+
end_of_line = lf
24+
indent_style = space
25+
indent_size = 2
26+
trim_trailing_whitespace = true
27+
insert_final_newline = true
28+
29+
[*.html]
30+
charset = utf-8
31+
end_of_line = lf
32+
indent_style = space
33+
indent_size = 2
34+
trim_trailing_whitespace = true
35+
insert_final_newline = true

.eslintignore

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
/node_modules/**
2+
3+
/tests/integration/*/
4+
5+
/examples/*/dist
6+
/examples/*/dist.*/**
7+
8+
/dist/**
9+
/dist.*/**
10+
11+
!/src/**

.eslintrc.js

+32-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,35 @@
1-
// https://eslint.org/
1+
/*!
2+
This file is part of CycloneDX Webpack plugin.
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
16+
SPDX-License-Identifier: Apache-2.0
17+
Copyright (c) OWASP Foundation. All Rights Reserved.
18+
*/
19+
20+
/**
21+
* @see {@link https://eslint.org/}
22+
* @type {import('eslint').Linter.Config}
23+
*/
224
module.exports = {
325
root: true,
4-
// see https://github.com/standard/standard
5-
extends: 'standard'
26+
// see https://github.com/standard/ts-standard
27+
extends: 'standard-with-typescript',
28+
parserOptions: {
29+
project: './tsconfig.json'
30+
},
31+
env: {
32+
node: true,
33+
browser: false
34+
}
635
}

.gitattributes

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
2+
tsconfig.json linguist-language=JSON-with-Comments
3+
tsconfig.*.json linguist-language=JSON-with-Comments

.github/workflows/nodejs.yml

+60-26
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ name: Node CI
55

66
on:
77
push:
8-
branches: ["master"]
8+
branches: [ "master" ]
99
pull_request:
1010
workflow_dispatch:
1111

@@ -14,7 +14,53 @@ env:
1414
NODE_ACTIVE_LTS: "16" # https://nodejs.org/en/about/releases/
1515

1616
jobs:
17+
build:
18+
name: build ${{ matrix.target }}
19+
runs-on: "ubuntu-latest"
20+
timeout-minutes: 30
21+
steps:
22+
- name: Checkout
23+
# see https://github.com/actions/checkout
24+
uses: actions/checkout@v3
25+
- name: Setup Node.js ${{ env.NODE_ACTIVE_LTS }}
26+
# see https://github.com/actions/setup-node
27+
uses: actions/setup-node@v3
28+
with:
29+
node-version: ${{ env.NODE_ACTIVE_LTS }}
30+
cache: "npm"
31+
cache-dependency-path: "**/package-lock.json"
32+
- name: setup project
33+
run: npm ci --ignore-scripts
34+
- name: build ${{ matrix.target }}
35+
run: npm run build
36+
- name: artifact build result
37+
# see https://github.com/actions/upload-artifact
38+
uses: actions/upload-artifact@v3
39+
with:
40+
name: dist
41+
path: dist
42+
if-no-files-found: error
43+
test-standard:
44+
name: test standard
45+
runs-on: ubuntu-latest
46+
timeout-minutes: 30
47+
steps:
48+
- name: Checkout
49+
# see https://github.com/actions/checkout
50+
uses: actions/checkout@v3
51+
- name: Setup Node.js ${{ env.NODE_ACTIVE_LTS }}
52+
# see https://github.com/actions/setup-node
53+
uses: actions/setup-node@v3
54+
with:
55+
node-version: ${{ env.NODE_ACTIVE_LTS }}
56+
cache: "npm"
57+
cache-dependency-path: "**/package-lock.json"
58+
- name: setup project
59+
run: npm ci --ignore-scripts
60+
- name: test
61+
run: npm run test:standard
1762
test-jest:
63+
needs: [ 'build' ]
1864
name: test:Jest (node${{ matrix.node-version }}, ${{ matrix.os }})
1965
timeout-minutes: 30
2066
runs-on: ${{ matrix.os }}
@@ -28,7 +74,7 @@ jobs:
2874
- "18" # current
2975
- "16" # active LTS
3076
- "14"
31-
- "12"
77+
- "14.0.0" # lowest supported
3278
env:
3379
REPORTS_ARTIFACT: tests-reports
3480
steps:
@@ -42,34 +88,22 @@ jobs:
4288
node-version: ${{ matrix.node-version }}
4389
cache: "npm"
4490
cache-dependency-path: "**/package-lock.json"
45-
- name: update npm
46-
run: npm i -g npm
91+
- # some integration tests require a certain npm version to be installable
92+
name: update npm
93+
run: npm i -g npm@^8
4794
- name: display version
4895
run: |-
4996
node --version
5097
npm --version
5198
- name: install project
52-
run: npm ci
53-
- name: build
54-
run: npm run build --if-present
99+
run: npm ci --ignore-scripts
100+
- name: fetch build artifact
101+
# see https://github.com/actions/download-artifact
102+
uses: actions/download-artifact@v3
103+
with:
104+
name: dist
105+
path: dist
106+
- name: setup test beds
107+
run: npm run setup-tests
55108
- name: test
56109
run: npm run test:jest
57-
standards:
58-
name: Standards
59-
timeout-minutes: 30
60-
runs-on: "ubuntu-latest"
61-
steps:
62-
- name: Checkout
63-
# see https://github.com/actions/checkout
64-
uses: actions/checkout@v3
65-
- name: Setup Node.js ${{ env.NODE_ACTIVE_LTS }}
66-
# see https://github.com/actions/setup-node
67-
uses: actions/setup-node@v3
68-
with:
69-
node-version: ${{ env.NODE_ACTIVE_LTS }}
70-
cache: "npm"
71-
cache-dependency-path: "**/package-lock.json"
72-
- name: install project
73-
run: npm ci
74-
- name: run tests
75-
run: npm run test:standard

.github/workflows/release.yml

+11-6
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ jobs:
5959
## ! no npm build at the moment
6060
- name: bump VERSION
6161
id: bump
62-
run: |
62+
run: |-
6363
VERSION="$(npm version "$NPMV_NEWVERSION" --message "$NPMV_MESSAGE")"
6464
echo "::debug::new version = $VERSION"
6565
VERSION_PLAIN="${VERSION:1}" # remove 'v' prefix
@@ -84,12 +84,19 @@ jobs:
8484
uses: actions/checkout@v3
8585
with:
8686
ref: ${{ needs.bump.outputs.version }}
87+
- name: Setup Node.js ${{ env.NODE_ACTIVE_LTS }}
88+
# see https://github.com/actions/setup-node
89+
uses: actions/setup-node@v3
90+
with:
91+
node-version: ${{ env.NODE_ACTIVE_LTS }}
92+
- name: setup project
93+
run: npm ci --ignore-scripts
8794
- name: publish to NPM
88-
run: |
89-
npm config set "//registry.npmjs.org/:_authToken=$NODE_AUTH_TOKEN"
95+
run: |-
96+
npm config set "//registry.npmjs.org/:_authToken=$NPMJS_AUTH_TOKEN"
9097
npm publish --access public
9198
env:
92-
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
99+
NPMJS_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
93100

94101
release-GH:
95102
needs:
@@ -113,5 +120,3 @@ jobs:
113120
tag_name: ${{ needs.bump.outputs.version }}
114121
name: ${{ needs.bump.outputs.version_plain }}
115122
prerelease: ${{ startsWith(github.event.inputs.newversion, 'pre') }}
116-
files: |
117-
${{ env.ASSETS_DIR }}/${{ env.ARTIFACT_DOCKER_SBOM }}/*.bom.*

.npmignore

+7-1
Original file line numberDiff line numberDiff line change
@@ -149,14 +149,20 @@ dist
149149
# project internals can be ignored
150150
/CODEOWNERS
151151
/CONTRIBUTING.*
152+
/HISTORY.md
152153

153154
# these files are part of the license
154155
!/LICENSE
155156
!/NOTICE
156157

157158
# never ignore the build results - these are intended to be shipped
158159
!/dist/
159-
!/dist.*/
160+
161+
# no intention to ship the maps, since the source is not shipped either.
162+
/dist/*.map
163+
164+
/src/
165+
/tsconfig.json
160166

161167
/test/
162168
/tests/

CONTRIBUTING.md

+13-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,19 @@ first.
77

88
## Setup
99

10-
To start developing simply run `npm ci` to install dev-dependencies and tools.
10+
To start developing simply run to install dev-dependencies and tools:
11+
12+
```shell
13+
npm ci
14+
```
15+
16+
This will install process automatically build the project from source.
17+
18+
## Build from source
19+
20+
```shell
21+
npm run build
22+
```
1123

1224
## Testing
1325

HISTORY.md

+26
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,32 @@ All notable changes to this project will be documented in this file.
44

55
## unreleased
66

7+
## 3.0.0 - 2022-06-20
8+
9+
This is a reboot, written in _TypeScript_ and compiled to _JavaScript_.
10+
11+
* BREAKING changes
12+
* Requires _Node.js_ `>= 14.0.0` now, was `>= 12.0.0`.
13+
* Requires _webpack_ version `^5` as a `peerDependency`, was `>=4 <6`.
14+
* Changed:
15+
* The optional configuration options changed in name and meaning. Consult the `README` for details.
16+
* Added
17+
* Added an optional switch to select the desired CycloneDX spec version for the output.
18+
The value currently defaults to `'1.4'`. (fixes [#53] via [#70])
19+
* Full support for typing. This will make the configuration of this plugin easier.
20+
* Lots of small features got added due to the fact that the data processing is managed by `@cyclonedx/cyclonedx-library` now.
21+
* Fixed
22+
* Dependency graph no longer has `null` or `undefined` values. (fixes [#31] via [#70])
23+
* Removed
24+
* The optional config option `emitStats` and its functionality were dropped.
25+
You may use _webpack_'s `--stats` switch instead.
26+
* Misc
27+
* Uses `@cyclonedx/cyclonedx-library` now, instead of `@cyclonedx/bom`.
28+
29+
[#31]: https://github.com/CycloneDX/cyclonedx-webpack-plugin/issues/31
30+
[#53]: https://github.com/CycloneDX/cyclonedx-webpack-plugin/issues/53
31+
[#70]: https://github.com/CycloneDX/cyclonedx-webpack-plugin/pull/70
32+
733
## 2.0.2 - 2022-06-11
834

935
* Fixed

0 commit comments

Comments
 (0)