Skip to content

Commit 92b2a01

Browse files
committed
Add for_packages test #2929
Signed-off-by: Jono Yang <[email protected]>
1 parent cfebc0c commit 92b2a01

File tree

7 files changed

+692
-3
lines changed

7 files changed

+692
-3
lines changed

src/packagedcode/npm.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ def assemble(cls, package_data, resource, codebase):
120120
package_uid = None
121121

122122
# in all cases yield possible dependencies
123-
yield_npm_dependencies_from_package_data(package_data, package_resource.path, package_uid)
123+
yield from yield_npm_dependencies_from_package_data(package_data, package_resource.path, package_uid)
124124

125125
# we yield this as we do not want this further processed
126126
yield package_resource
Lines changed: 293 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,293 @@
1+
{
2+
"headers": [
3+
{
4+
"tool_name": "scancode-toolkit",
5+
"options": {
6+
"input": "<path>",
7+
"--json": "<file>",
8+
"--package": true
9+
},
10+
"notice": "Generated with ScanCode and provided on an \"AS IS\" BASIS, WITHOUT WARRANTIES\nOR CONDITIONS OF ANY KIND, either express or implied. No content created from\nScanCode should be considered or used as legal advice. Consult an Attorney\nfor any legal advice.\nScanCode is a free software code scanning tool from nexB Inc. and others.\nVisit https://github.com/nexB/scancode-toolkit/ for support and download.",
11+
"output_format_version": "2.0.0",
12+
"message": null,
13+
"errors": [],
14+
"warnings": [],
15+
"extra_data": {
16+
"system_environment": {
17+
"operating_system": "linux",
18+
"cpu_architecture": "64",
19+
"platform": "Linux-5.4.0-107-generic-x86_64-with-Ubuntu-18.04-bionic",
20+
"platform_version": "#121~18.04.1-Ubuntu SMP Thu Mar 24 17:21:33 UTC 2022",
21+
"python_version": "3.6.9 (default, Mar 15 2022, 13:55:28) \n[GCC 8.4.0]"
22+
},
23+
"spdx_license_list_version": "3.16",
24+
"files_count": 2
25+
}
26+
}
27+
],
28+
"dependencies": [
29+
{
30+
"purl": "pkg:npm/%40types/node",
31+
"extracted_requirement": "^8.0.24",
32+
"scope": "dependencies",
33+
"is_runtime": true,
34+
"is_optional": false,
35+
"is_resolved": false,
36+
"resolved_package": {},
37+
"dependency_uid": "pkg:npm/%40types/node?uuid=fixed-uid-done-for-testing-5642512d1758",
38+
"for_package_uid": "pkg:npm/[email protected]?uuid=fixed-uid-done-for-testing-5642512d1758",
39+
"datafile_path": "package/package.json",
40+
"datasource_id": "npm_package_json"
41+
},
42+
{
43+
"purl": "pkg:npm/electron-download",
44+
"extracted_requirement": "^4.1.0",
45+
"scope": "dependencies",
46+
"is_runtime": true,
47+
"is_optional": false,
48+
"is_resolved": false,
49+
"resolved_package": {},
50+
"dependency_uid": "pkg:npm/electron-download?uuid=fixed-uid-done-for-testing-5642512d1758",
51+
"for_package_uid": "pkg:npm/[email protected]?uuid=fixed-uid-done-for-testing-5642512d1758",
52+
"datafile_path": "package/package.json",
53+
"datasource_id": "npm_package_json"
54+
},
55+
{
56+
"purl": "pkg:npm/extract-zip",
57+
"extracted_requirement": "^1.0.3",
58+
"scope": "dependencies",
59+
"is_runtime": true,
60+
"is_optional": false,
61+
"is_resolved": false,
62+
"resolved_package": {},
63+
"dependency_uid": "pkg:npm/extract-zip?uuid=fixed-uid-done-for-testing-5642512d1758",
64+
"for_package_uid": "pkg:npm/[email protected]?uuid=fixed-uid-done-for-testing-5642512d1758",
65+
"datafile_path": "package/package.json",
66+
"datasource_id": "npm_package_json"
67+
},
68+
{
69+
"purl": "pkg:npm/home-path",
70+
"extracted_requirement": "^0.1.1",
71+
"scope": "devDependencies",
72+
"is_runtime": false,
73+
"is_optional": true,
74+
"is_resolved": false,
75+
"resolved_package": {},
76+
"dependency_uid": "pkg:npm/home-path?uuid=fixed-uid-done-for-testing-5642512d1758",
77+
"for_package_uid": "pkg:npm/[email protected]?uuid=fixed-uid-done-for-testing-5642512d1758",
78+
"datafile_path": "package/package.json",
79+
"datasource_id": "npm_package_json"
80+
},
81+
{
82+
"purl": "pkg:npm/path-exists",
83+
"extracted_requirement": "^2.0.0",
84+
"scope": "devDependencies",
85+
"is_runtime": false,
86+
"is_optional": true,
87+
"is_resolved": false,
88+
"resolved_package": {},
89+
"dependency_uid": "pkg:npm/path-exists?uuid=fixed-uid-done-for-testing-5642512d1758",
90+
"for_package_uid": "pkg:npm/[email protected]?uuid=fixed-uid-done-for-testing-5642512d1758",
91+
"datafile_path": "package/package.json",
92+
"datasource_id": "npm_package_json"
93+
},
94+
{
95+
"purl": "pkg:npm/standard",
96+
"extracted_requirement": "^5.4.1",
97+
"scope": "devDependencies",
98+
"is_runtime": false,
99+
"is_optional": true,
100+
"is_resolved": false,
101+
"resolved_package": {},
102+
"dependency_uid": "pkg:npm/standard?uuid=fixed-uid-done-for-testing-5642512d1758",
103+
"for_package_uid": "pkg:npm/[email protected]?uuid=fixed-uid-done-for-testing-5642512d1758",
104+
"datafile_path": "package/package.json",
105+
"datasource_id": "npm_package_json"
106+
}
107+
],
108+
"packages": [
109+
{
110+
"type": "npm",
111+
"namespace": null,
112+
"name": "electron",
113+
"version": "3.1.11",
114+
"qualifiers": {},
115+
"subpath": null,
116+
"primary_language": "JavaScript",
117+
"description": "Build cross platform desktop apps with JavaScript, HTML, and CSS",
118+
"release_date": null,
119+
"parties": [
120+
{
121+
"type": "person",
122+
"role": "author",
123+
"name": "Electron Community",
124+
"email": null,
125+
"url": null
126+
}
127+
],
128+
"keywords": [
129+
"electron"
130+
],
131+
"homepage_url": null,
132+
"download_url": "https://registry.npmjs.org/electron/-/electron-3.1.11.tgz",
133+
"size": null,
134+
"sha1": null,
135+
"md5": null,
136+
"sha256": null,
137+
"sha512": null,
138+
"bug_tracking_url": null,
139+
"code_view_url": null,
140+
"vcs_url": "https://github.com/electron/electron",
141+
"copyright": null,
142+
"license_expression": "mit",
143+
"declared_license": [
144+
"MIT"
145+
],
146+
"notice_text": null,
147+
"source_packages": [],
148+
"extra_data": {},
149+
"repository_homepage_url": "https://www.npmjs.com/package/electron",
150+
"repository_download_url": "https://registry.npmjs.org/electron/-/electron-3.1.11.tgz",
151+
"api_data_url": "https://registry.npmjs.org/electron/3.1.11",
152+
"package_uid": "pkg:npm/[email protected]?uuid=fixed-uid-done-for-testing-5642512d1758",
153+
"datafile_paths": [
154+
"package/package.json"
155+
],
156+
"datasource_ids": [
157+
"npm_package_json"
158+
],
159+
"purl": "pkg:npm/[email protected]"
160+
}
161+
],
162+
"files": [
163+
{
164+
"path": "package",
165+
"type": "directory",
166+
"package_data": [],
167+
"for_packages": [],
168+
"scan_errors": []
169+
},
170+
{
171+
"path": "package/cli.js",
172+
"type": "file",
173+
"package_data": [],
174+
"for_packages": [
175+
"pkg:npm/[email protected]?uuid=fixed-uid-done-for-testing-5642512d1758"
176+
],
177+
"scan_errors": []
178+
},
179+
{
180+
"path": "package/package.json",
181+
"type": "file",
182+
"package_data": [
183+
{
184+
"type": "npm",
185+
"namespace": null,
186+
"name": "electron",
187+
"version": "3.1.11",
188+
"qualifiers": {},
189+
"subpath": null,
190+
"primary_language": "JavaScript",
191+
"description": "Build cross platform desktop apps with JavaScript, HTML, and CSS",
192+
"release_date": null,
193+
"parties": [
194+
{
195+
"type": "person",
196+
"role": "author",
197+
"name": "Electron Community",
198+
"email": null,
199+
"url": null
200+
}
201+
],
202+
"keywords": [
203+
"electron"
204+
],
205+
"homepage_url": null,
206+
"download_url": "https://registry.npmjs.org/electron/-/electron-3.1.11.tgz",
207+
"size": null,
208+
"sha1": null,
209+
"md5": null,
210+
"sha256": null,
211+
"sha512": null,
212+
"bug_tracking_url": null,
213+
"code_view_url": null,
214+
"vcs_url": "https://github.com/electron/electron",
215+
"copyright": null,
216+
"license_expression": "mit",
217+
"declared_license": [
218+
"MIT"
219+
],
220+
"notice_text": null,
221+
"source_packages": [],
222+
"file_references": [],
223+
"extra_data": {},
224+
"dependencies": [
225+
{
226+
"purl": "pkg:npm/%40types/node",
227+
"extracted_requirement": "^8.0.24",
228+
"scope": "dependencies",
229+
"is_runtime": true,
230+
"is_optional": false,
231+
"is_resolved": false,
232+
"resolved_package": {}
233+
},
234+
{
235+
"purl": "pkg:npm/electron-download",
236+
"extracted_requirement": "^4.1.0",
237+
"scope": "dependencies",
238+
"is_runtime": true,
239+
"is_optional": false,
240+
"is_resolved": false,
241+
"resolved_package": {}
242+
},
243+
{
244+
"purl": "pkg:npm/extract-zip",
245+
"extracted_requirement": "^1.0.3",
246+
"scope": "dependencies",
247+
"is_runtime": true,
248+
"is_optional": false,
249+
"is_resolved": false,
250+
"resolved_package": {}
251+
},
252+
{
253+
"purl": "pkg:npm/home-path",
254+
"extracted_requirement": "^0.1.1",
255+
"scope": "devDependencies",
256+
"is_runtime": false,
257+
"is_optional": true,
258+
"is_resolved": false,
259+
"resolved_package": {}
260+
},
261+
{
262+
"purl": "pkg:npm/path-exists",
263+
"extracted_requirement": "^2.0.0",
264+
"scope": "devDependencies",
265+
"is_runtime": false,
266+
"is_optional": true,
267+
"is_resolved": false,
268+
"resolved_package": {}
269+
},
270+
{
271+
"purl": "pkg:npm/standard",
272+
"extracted_requirement": "^5.4.1",
273+
"scope": "devDependencies",
274+
"is_runtime": false,
275+
"is_optional": true,
276+
"is_resolved": false,
277+
"resolved_package": {}
278+
}
279+
],
280+
"repository_homepage_url": "https://www.npmjs.com/package/electron",
281+
"repository_download_url": "https://registry.npmjs.org/electron/-/electron-3.1.11.tgz",
282+
"api_data_url": "https://registry.npmjs.org/electron/3.1.11",
283+
"datasource_id": "npm_package_json",
284+
"purl": "pkg:npm/[email protected]"
285+
}
286+
],
287+
"for_packages": [
288+
"pkg:npm/[email protected]?uuid=fixed-uid-done-for-testing-5642512d1758"
289+
],
290+
"scan_errors": []
291+
}
292+
]
293+
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#!/usr/bin/env node
2+
3+
var electron = require('./')
4+
5+
var proc = require('child_process')
6+
7+
var child = proc.spawn(electron, process.argv.slice(2), {stdio: 'inherit', windowsHide: false})
8+
child.on('close', function (code) {
9+
process.exit(code)
10+
})
11+
12+
const handleTerminationSignal = function (signal) {
13+
process.on(signal, function signalHandler () {
14+
if (!child.killed) {
15+
child.kill(signal)
16+
}
17+
})
18+
}
19+
20+
handleTerminationSignal('SIGINT')
21+
handleTerminationSignal('SIGTERM')
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
{
2+
"scripts": {
3+
"cache-clean": "rm -rf ~/.electron && rm -rf dist",
4+
"postinstall": "node install.js",
5+
"pretest": "npm run cache-clean",
6+
"test": "standard"
7+
},
8+
"bin": {
9+
"electron": "cli.js"
10+
},
11+
"main": "index.js",
12+
"types": "electron.d.ts",
13+
"dependencies": {
14+
"@types/node": "^8.0.24",
15+
"electron-download": "^4.1.0",
16+
"extract-zip": "^1.0.3"
17+
},
18+
"devDependencies": {
19+
"home-path": "^0.1.1",
20+
"path-exists": "^2.0.0",
21+
"standard": "^5.4.1"
22+
},
23+
"directories": {
24+
"test": "test"
25+
},
26+
"engines": {
27+
"node": ">= 4.0"
28+
},
29+
"name": "electron",
30+
"version": "3.1.11",
31+
"repository": "https://github.com/electron/electron",
32+
"description": "Build cross platform desktop apps with JavaScript, HTML, and CSS",
33+
"license": "MIT",
34+
"author": "Electron Community",
35+
"keywords": [
36+
"electron"
37+
]
38+
}

0 commit comments

Comments
 (0)