ts-node-client 1.8.4 → 1.8.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -8,14 +8,12 @@
8
8
 
9
9
  [![npm package](https://nodei.co/npm/ts-node-client.png?downloads=true&downloadRank=true&stars=true)](https://nodei.co/npm/ts-node-client/)
10
10
 
11
- TrustSource node client
12
-
13
- > node module to transfer dependency information to TrustSource server.
11
+ > TrustSource node client - node module to transfer dependency information to TrustSource server.
14
12
 
15
13
  ## Requirements
16
-
17
14
  * node >= 8.9.0
18
- * npm < 8.0.0
15
+ * npm < 8.0.0 use **ts-node-client@1.***
16
+ * npm >= 8.0.0 use **ts-node-client@2.***
19
17
 
20
18
  ## Installation
21
19
  Run: `npm install --save-dev ts-node-client` or `yarn add --dev ts-node-client`
@@ -48,8 +46,8 @@ You also may initiate transfer to TrustSource server manually by executing follo
48
46
 
49
47
  ```
50
48
  node_modules/.bin/ts-node-client
51
- node_modules/.bin/ts-node-client -k apiKey -p Project
52
- node_modules/.bin/ts-node-client -c config.json
49
+ node_modules/.bin/ts-node-client -k apiKey -p Project --breakOnWarnings false --breakOnViolations true
50
+ node_modules/.bin/ts-node-client -c config.json
53
51
  ```
54
52
  ```
55
53
  npm / node module to transfer dependency information to TrustSource server.
@@ -65,7 +63,7 @@ Options:
65
63
  --proxy Proxy url like 'https://user:password@host:port' [default: null]
66
64
  --version, -v Prints a version [default: false]
67
65
  --saveAs, -o Save as file (file name prefix) [default: null]
68
- --saveAsFormat, --of Save as format (scan / cydx / spdx) [default: null]
66
+ --saveAsFormat, -of Save as format (scan / cydx / spdx) [default: null]
69
67
  --debug [default: null]
70
68
  --simulate [default: null]
71
69
  --includeDevDependencies [default: null]
@@ -73,7 +71,12 @@ Options:
73
71
  --breakOnWarnings [default: null]
74
72
  --breakOnViolations [default: null]
75
73
  --help Prints a usage statement [boolean]
74
+
76
75
  ```
76
+ PLEASE NOTE: if you want to pass param into function
77
+ you should add value, for example:
78
+
79
+ `--breakOnViolations true` or `--saveAs sbom`
77
80
 
78
81
  ## Software bill of materials
79
82
 
@@ -83,94 +86,72 @@ Options:
83
86
  ## Known problems
84
87
 
85
88
  #### Error: The programmatic API was removed in npm v8.0.0
86
- You should upgrade to later versions of ts-node-client
89
+ You should upgrade to 2.* versions of ts-node-client
87
90
 
88
91
  ## Changelog
89
92
 
93
+ #### 2.0
94
+ - Support new scan tool and fix problem with programmatic API for >= npm@8.0.0
95
+
90
96
  #### 1.8.*
91
97
  - SBOM
92
98
  - **--saveAs** and **--saveAsFormat**
93
99
  - Bump minimist from 1.2.5 to 1.2.6
94
100
  - Bump urijs from 1.19.10 to 1.19.11
101
+ - replace packageurl-js with simple local function
102
+ - improve docs
95
103
 
96
104
  #### 1.7.*
97
105
  - request -> axios
98
106
  - fix dependencies
99
107
  - doc fixes
100
108
 
101
- #### 1.6.0
109
+ #### 1.6.*
102
110
  - **--breakOnWarnings** and **--breakOnViolations**
103
111
  - Bump devDependencies
104
112
 
105
- #### 1.5.2
113
+ #### 1.5.*
106
114
  - Describe `Error: The programmatic API was removed in npm v8.0.0`
107
-
108
- #### 1.5.1
109
115
  - Bump devDependencies
110
116
  - Introduce sonarjs
111
117
 
112
- #### 1.4.3
118
+ #### 1.4.*
113
119
  - Bump glob-parent from 5.1.1 to 5.1.2
114
120
  - Bump path-parse from 1.0.6 to 1.0.7
115
-
116
- #### 1.4.2
117
121
  - Bump lodash from 4.17.19 to 4.17.21
118
-
119
- #### 1.4.1
120
122
  - Bump y18n from 4.0.0 to 4.0.1
121
-
122
- #### 1.4.0
123
123
  - Added:
124
124
  - option **--includeDevDependencies**. It is allow to scan dev dependencies
125
125
 
126
- #### 1.3.1
126
+ #### 1.3.*
127
127
  - Use [`global-npm`](https://github.com/dracupid/global-npm) (meaning `npm` is no longer a dependency of `ts-node-client`)
128
128
 
129
- #### 1.2.3
129
+ #### 1.2.*
130
130
  - Added:
131
131
  - option **--brakeOnViolations**. It is fail build in case any violations after scan transferred.
132
132
  - option **--brakeOnWarnings**. It is fail build in case any warning after scan transferred.
133
133
 
134
- #### 1.1.2
134
+ #### 1.1.*
135
135
  - userName is not required param for scans
136
136
  - Support usage of scan meta param binaryLinks inside Options definition
137
137
 
138
-
139
- #### 1.0.0
138
+ #### 1.0.*
140
139
  - Node JS and dependencies updates "node": ">= 8.12.0"
141
140
 
142
- #### 0.3.4 - 0.3.6
141
+ #### 0.3.*
143
142
  - Improve variable usage and tasks migration
144
-
145
- #### 0.3.3
146
143
  - Support usage of scan meta params: branch and tag inside Options definition
147
-
148
- #### 0.3.2
149
144
  - Skip npmDependency without names
150
-
151
- #### 0.3.1
152
145
  - Update travis config
153
-
154
- #### 0.3.0
155
146
  - Update dependency to resolve vulnerabilities
156
147
 
157
- #### 0.2.5
148
+ #### 0.2.*
158
149
  - Added proxy support and config
159
-
160
- #### 0.2.4
161
150
  - Update travis config
162
-
163
- #### 0.2.3
164
151
  - Updated README.md with `app.trustsource.io`
165
-
166
- #### 0.2.2
167
152
  - Updated default url to `app.trustsource.io`
168
-
169
- #### 0.2.1
170
153
  - Added windows support
171
154
  - Fixed json
172
-
173
- #### 0.2.0
174
155
  - **Removed:**
175
156
  - options: **--credentials** and **--credentialsFile** instead you should use **--config**.
176
157
  - option **--baseUrl** instead you should use **--url**.
package/lib/convertor.js CHANGED
@@ -5,7 +5,7 @@
5
5
  * SPDX-License-Identifier: Apache-2.0
6
6
  *********************************************************/
7
7
  /* eslint-enable */
8
- const PackageURL = require('packageurl-js');
8
+ const PackageURL = require('./pkg');
9
9
 
10
10
  const Convertor = {};
11
11
 
@@ -65,8 +65,7 @@ function getPackageUrl(componentKey, version) {
65
65
  const org = parts.length > 1 ? parts[0] : null;
66
66
  const key = parts.length > 1 ? parts[1] : parts[0];
67
67
  if (key) {
68
- const packageUrl = new PackageURL(result.manager, org, key, version);
69
- return packageUrl.toString();
68
+ return PackageURL.get(result.manager, org, key, version);
70
69
  }
71
70
  return null;
72
71
  }
package/lib/pkg.js ADDED
@@ -0,0 +1,32 @@
1
+ /* eslint-disable */
2
+ /**********************************************************
3
+ * Copyright (c) 2022. Enterprise Architecture Group, EACG
4
+ *
5
+ * SPDX-License-Identifier: Apache-2.0
6
+ *********************************************************/
7
+ /* eslint-enable */
8
+
9
+ const PackageURL = {};
10
+
11
+ PackageURL.get = function get(manager, org, key, version) {
12
+ // scheme:type/namespace/name@version?qualifiers#subpath
13
+ const parts = [];
14
+ let partVersion;
15
+ if (manager) {
16
+ parts.push(encodeURI(manager));
17
+ }
18
+ if (org) {
19
+ parts.push(encodeURI(org).replace('%3A', ':'));
20
+ }
21
+ if (key) {
22
+ parts.push(encodeURI(key).replace('%3A', ':'));
23
+ }
24
+ if (version) {
25
+ partVersion = `@${encodeURI(version).replace('%3A', ':')}`;
26
+ }
27
+ return `pkg:${parts.join('/')}${partVersion}`;
28
+ };
29
+
30
+
31
+ module.exports = PackageURL;
32
+
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "ts-node-client",
3
3
  "description": "npm / node module to transfer dependency information to TrustSource server.",
4
- "version": "1.8.4",
4
+ "version": "1.8.7",
5
5
  "private": false,
6
6
  "homepage": "https://app.trustsource.io/",
7
7
  "author": {
@@ -23,8 +23,9 @@
23
23
  },
24
24
  "scripts": {
25
25
  "scan": "node ./bin/ts-node-client.js",
26
- "scan-with-brakes": "ts-node-client --breakOnViolations true --breakOnWarnings true",
27
- "scan-prod": "ts-node-client --debug true",
26
+ "scan-with-brakes": "node ./bin/ts-node-client.js --breakOnViolations true --breakOnWarnings true",
27
+ "scan-to-file": "node ./bin/ts-node-client.js --saveAsFormat cydx --saveAs test",
28
+ "scan-prod": "node ./bin/ts-node-client.js --debug true",
28
29
  "lint": "eslint bin lib test",
29
30
  "lint-fix": "eslint bin lib test --fix",
30
31
  "test": "mocha test",
@@ -35,8 +36,7 @@
35
36
  "debuglog": "1.0.1",
36
37
  "global-npm": "0.5.0",
37
38
  "semver": "7.3.5",
38
- "yargs": "^15.4.1",
39
- "packageurl-js": "github:eacg-gmbh/packageurl-js#v0.1.1"
39
+ "yargs": "^15.4.1"
40
40
  },
41
41
  "devDependencies": {
42
42
  "eslint": "^7.32.0",
@@ -44,8 +44,7 @@
44
44
  "eslint-plugin-import": "^2.25.2",
45
45
  "eslint-plugin-sonarjs": "^0.10.0",
46
46
  "mocha": "^9.2.2",
47
- "nock": "^12.0.3",
48
- "ts-node-client": "1.8.3"
47
+ "nock": "^12.0.3"
49
48
  },
50
49
  "keywords": [
51
50
  "node",