Skip to content

Commit f3048cf

Browse files
authored
feat: support parsing NuGet packages.lock.json lockfiles (#165)
1 parent 3035542 commit f3048cf

17 files changed

+374
-0
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ The detector supports parsing the following lockfiles:
5454
| ----------------------------- | ----------- | ---------- |
5555
| `buildscript-gradle.lockfile` | `Maven` | `gradle` |
5656
| `Cargo.lock` | `crates.io` | `cargo` |
57+
| `packages.lock.json` | `NuGet` | `dotnet` |
5758
| `package-lock.json` | `npm` | `npm` |
5859
| `yarn.lock` | `npm` | `yarn` |
5960
| `pnpm-lock.yaml` | `npm` | `pnpm` |

internal/reporter/reporter_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -265,6 +265,7 @@ func TestReporter_PrintKnownEcosystems(t *testing.T) {
265265
expected := strings.Join([]string{
266266
"The detector supports parsing for the following ecosystems:",
267267
" npm",
268+
" NuGet",
268269
" crates.io",
269270
" RubyGems",
270271
" Packagist",

main_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,7 @@ func TestRun(t *testing.T) {
139139
gradle.lockfile
140140
mix.lock
141141
package-lock.json
142+
packages.lock.json
142143
pnpm-lock.yaml
143144
poetry.lock
144145
pom.xml

pkg/lockfile/ecosystems.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package lockfile
33
func KnownEcosystems() []Ecosystem {
44
return []Ecosystem{
55
NpmEcosystem,
6+
NuGetEcosystem,
67
CargoEcosystem,
78
BundlerEcosystem,
89
ComposerEcosystem,
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"version": 0,
3+
"dependencies": {}
4+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"version": 1,
3+
"dependencies": {}
4+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
this is not json!
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"version": 1,
3+
"dependencies": {
4+
"net6.0": {
5+
"Test.Core": {
6+
"type": "Direct",
7+
"requested": "[6.0.5, )",
8+
"resolved": "6.0.5",
9+
"contentHash": "FwdQVtpj34xt8vKyFUUeNIS+obWlEnSrSW7y1ivRVts/ZsrUsKyOd0bZehgFhWdnB/NBsa9DCWvNFMTO0XDFcg=="
10+
}
11+
}
12+
}
13+
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
{
2+
"version": 1,
3+
"dependencies": {
4+
"net6.0": {
5+
"Test.Core": {
6+
"type": "Direct",
7+
"requested": "[6.0.5, )",
8+
"resolved": "6.0.5",
9+
"contentHash": "FwdQVtpj34xt8vKyFUUeNIS+obWlEnSrSW7y1ivRVts/ZsrUsKyOd0bZehgFhWdnB/NBsa9DCWvNFMTO0XDFcg=="
10+
},
11+
"Test.System": {
12+
"type": "Direct",
13+
"requested": "[0.13.0-beta4, )",
14+
"resolved": "0.13.0-beta4",
15+
"contentHash": "5r9yBPe7XOnb4zAQYzyvlt85dpuIJQkPJYEns5hpfv/JbC4uBHVqnrzqiPlTiaWEcXFgmDjjh0ihVB0vvChuCQ==",
16+
"dependencies": {
17+
"Test.Core": "6.0.0"
18+
}
19+
}
20+
}
21+
}
22+
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{
2+
"version": 1,
3+
"dependencies": {
4+
"net6.0": {
5+
"Test.Core": {
6+
"type": "Direct",
7+
"requested": "[6.0.5, )",
8+
"resolved": "6.0.5",
9+
"contentHash": "FwdQVtpj34xt8vKyFUUeNIS+obWlEnSrSW7y1ivRVts/ZsrUsKyOd0bZehgFhWdnB/NBsa9DCWvNFMTO0XDFcg=="
10+
}
11+
},
12+
"net7.0": {
13+
"Test.System": {
14+
"type": "Direct",
15+
"requested": "[0.13.0-beta4, )",
16+
"resolved": "0.13.0-beta4",
17+
"contentHash": "5r9yBPe7XOnb4zAQYzyvlt85dpuIJQkPJYEns5hpfv/JbC4uBHVqnrzqiPlTiaWEcXFgmDjjh0ihVB0vvChuCQ=="
18+
}
19+
}
20+
}
21+
}

0 commit comments

Comments
 (0)