ts-node-client 2.1.0 → 2.1.1

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.
@@ -39,7 +39,8 @@ Scanner.prototype.scan = function scan(cb) {
39
39
  const dependency = self.walk(data);
40
40
  const result = new ScanResult(
41
41
  options.project,
42
- data.name, `npm:${data.name}`,
42
+ data.name,
43
+ `npm:${data.name}`,
43
44
  dependency
44
45
  );
45
46
  debuglog('result: ', JSON.stringify(result));
@@ -73,9 +74,16 @@ Scanner.prototype.walk = function walk(npmDependency, level) {
73
74
  printDependency(npmDependency, level);
74
75
 
75
76
  if (npmDependency.name) {
76
- const dependency = new Dependency(npmDependency.name, npmDependency.version, 'npm', npmDependency.description,
77
- npmDependency.private, npmDependency.licenses || npmDependency.license,
78
- npmDependency.homepage, npmDependency.repository ? npmDependency.repository.url : undefined);
77
+ const dependency = new Dependency(
78
+ npmDependency.name,
79
+ npmDependency.version,
80
+ 'npm',
81
+ npmDependency.description,
82
+ npmDependency.private,
83
+ npmDependency.licenses || npmDependency.license,
84
+ npmDependency.homepage,
85
+ npmDependency.repository ? npmDependency.repository.url : undefined
86
+ );
79
87
 
80
88
  if (npmDependency.dependencies) {
81
89
  Object.getOwnPropertyNames(npmDependency.dependencies).forEach((val) => {
package/lib/pkg.js CHANGED
@@ -13,20 +13,24 @@ PackageURL.get = function get(manager, org, key, version) {
13
13
  const parts = [];
14
14
  let partVersion;
15
15
  if (manager) {
16
- parts.push(encodeURI(manager));
16
+ parts.push(fixPart(manager));
17
17
  }
18
18
  if (org) {
19
- parts.push(encodeURI(org).replace('%3A', ':'));
19
+ parts.push(fixPart(org));
20
20
  }
21
21
  if (key) {
22
- parts.push(encodeURI(key).replace('%3A', ':'));
22
+ parts.push(fixPart(key));
23
23
  }
24
24
  if (version) {
25
- partVersion = `@${encodeURI(version).replace('%3A', ':')}`;
25
+ partVersion = `@${fixPart(version)}`;
26
26
  }
27
27
  return `pkg:${parts.join('/')}${partVersion}`;
28
28
  };
29
29
 
30
+ function fixPart(str) {
31
+ const newStr = encodeURI(str);
32
+ return newStr.replace('%3A', ':');
33
+ }
30
34
 
31
35
  module.exports = PackageURL;
32
36
 
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": "2.1.0",
4
+ "version": "2.1.1",
5
5
  "private": false,
6
6
  "homepage": "https://app.trustsource.io/",
7
7
  "author": {
@@ -37,10 +37,10 @@
37
37
  "yargs": "^17.5.0"
38
38
  },
39
39
  "devDependencies": {
40
- "eslint": "^7.32.0",
41
- "eslint-config-airbnb-base": "^14.2.1",
42
- "eslint-plugin-import": "^2.25.2",
43
- "eslint-plugin-sonarjs": "^0.10.0",
40
+ "eslint": "^8.15.0",
41
+ "eslint-config-airbnb-base": "^15.0.0",
42
+ "eslint-plugin-import": "^2.26.0",
43
+ "eslint-plugin-sonarjs": "^0.13.0",
44
44
  "mocha": "^9.2.2",
45
45
  "nock": "^12.0.3"
46
46
  },
@@ -36,18 +36,24 @@ describe('Dependency', () => {
36
36
  it('should set license as object', () => {
37
37
  assert.deepEqual(new Dependency('---', '---', '---', '', true, 'MIT').licenses[0], { name: 'MIT' });
38
38
  assert.deepEqual(new Dependency('---', '---', '---', '', true, { type: 'MIT' }).licenses[0], { name: 'MIT' });
39
- assert.deepEqual(new Dependency('---', '---', '---', '', true, { type: 'MIT', url: 'https://test' }).licenses[0],
40
- { name: 'MIT', url: 'https://test' });
39
+ assert.deepEqual(
40
+ new Dependency('---', '---', '---', '', true, { type: 'MIT', url: 'https://test' }).licenses[0],
41
+ { name: 'MIT', url: 'https://test' }
42
+ );
41
43
  });
42
44
 
43
45
  it('should set license as array', () => {
44
- assert.deepEqual(new Dependency('---', '---', '---', '', true, ['MIT', 'Apache']).licenses,
45
- [{ name: 'MIT' }, { name: 'Apache' }]);
46
+ assert.deepEqual(
47
+ new Dependency('---', '---', '---', '', true, ['MIT', 'Apache']).licenses,
48
+ [{ name: 'MIT' }, { name: 'Apache' }]
49
+ );
46
50
  });
47
51
 
48
52
  it('should set license as array of objects', () => {
49
- assert.deepEqual(new Dependency('---', '---', '---', '', true, [{ type: 'MIT', url: 'url' }, { type: 'Apache' }]).licenses,
50
- [{ name: 'MIT', url: 'url' }, { name: 'Apache' }]);
53
+ assert.deepEqual(
54
+ new Dependency('---', '---', '---', '', true, [{ type: 'MIT', url: 'url' }, { type: 'Apache' }]).licenses,
55
+ [{ name: 'MIT', url: 'url' }, { name: 'Apache' }]
56
+ );
51
57
  });
52
58
 
53
59
  it('should not accept empty or invalid name', () => {
@@ -142,12 +148,32 @@ describe('Dependency', () => {
142
148
  });
143
149
 
144
150
  it('should extract additional repo-protocol from url', () => {
145
- assert.deepEqual(new Dependency('name', 'version', '---', 'description', '---', '---', 'home',
146
- 'git+https://github.com/eacg-gmbh/ecs-grunt-plugin.git').repoUrl,
147
- 'https://github.com/eacg-gmbh/ecs-grunt-plugin.git');
148
- assert.deepEqual(new Dependency('name', 'version', '---', 'description', '---', '---', 'home',
149
- 'svn+http://svnrepo.com/test.svn').repoUrl,
150
- 'http://svnrepo.com/test.svn');
151
+ assert.deepEqual(
152
+ new Dependency(
153
+ 'name',
154
+ 'version',
155
+ '---',
156
+ 'description',
157
+ '---',
158
+ '---',
159
+ 'home',
160
+ 'git+https://github.com/eacg-gmbh/ecs-grunt-plugin.git'
161
+ ).repoUrl,
162
+ 'https://github.com/eacg-gmbh/ecs-grunt-plugin.git'
163
+ );
164
+ assert.deepEqual(
165
+ new Dependency(
166
+ 'name',
167
+ 'version',
168
+ '---',
169
+ 'description',
170
+ '---',
171
+ '---',
172
+ 'home',
173
+ 'svn+http://svnrepo.com/test.svn'
174
+ ).repoUrl,
175
+ 'http://svnrepo.com/test.svn'
176
+ );
151
177
  });
152
178
 
153
179