Skip to content

Commit 0afa846

Browse files
committed
Don't default name is not available iin package-json
1 parent 4f11256 commit 0afa846

File tree

2 files changed

+3
-8
lines changed

2 files changed

+3
-8
lines changed

tap-snapshots/test/lib/commands/shrinkwrap.js.test.cjs

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ exports[`test/lib/commands/shrinkwrap.js TAP with hidden lockfile ancient > must
1616
},
1717
"config": {},
1818
"shrinkwrap": {
19-
"name": "prefix",
2019
"lockfileVersion": 1,
2120
"requires": true
2221
},
@@ -40,7 +39,6 @@ exports[`test/lib/commands/shrinkwrap.js TAP with hidden lockfile ancient upgrad
4039
"lockfile-version": 3
4140
},
4241
"shrinkwrap": {
43-
"name": "prefix",
4442
"lockfileVersion": 3,
4543
"requires": true,
4644
"packages": {}
@@ -65,7 +63,6 @@ exports[`test/lib/commands/shrinkwrap.js TAP with hidden lockfile existing > mus
6563
},
6664
"config": {},
6765
"shrinkwrap": {
68-
"name": "prefix",
6966
"lockfileVersion": 2,
7067
"requires": true,
7168
"packages": {}
@@ -90,7 +87,6 @@ exports[`test/lib/commands/shrinkwrap.js TAP with hidden lockfile existing downg
9087
"lockfile-version": 1
9188
},
9289
"shrinkwrap": {
93-
"name": "prefix",
9490
"lockfileVersion": 1,
9591
"requires": true
9692
},
@@ -116,7 +112,6 @@ exports[`test/lib/commands/shrinkwrap.js TAP with hidden lockfile existing upgra
116112
"lockfile-version": 3
117113
},
118114
"shrinkwrap": {
119-
"name": "prefix",
120115
"lockfileVersion": 3,
121116
"requires": true,
122117
"packages": {}
@@ -135,7 +130,6 @@ exports[`test/lib/commands/shrinkwrap.js TAP with nothing ancient > must match s
135130
"localPrefix": {},
136131
"config": {},
137132
"shrinkwrap": {
138-
"name": "prefix",
139133
"lockfileVersion": 3,
140134
"requires": true,
141135
"packages": {}
@@ -154,7 +148,6 @@ exports[`test/lib/commands/shrinkwrap.js TAP with nothing ancient upgrade > must
154148
"lockfile-version": 3
155149
},
156150
"shrinkwrap": {
157-
"name": "prefix",
158151
"lockfileVersion": 3,
159152
"requires": true,
160153
"packages": {}

workspaces/arborist/lib/shrinkwrap.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -970,7 +970,9 @@ class Shrinkwrap {
970970
#buildLegacyLockfile (node, lock, path = []) {
971971
if (node === this.tree) {
972972
// the root node
973-
lock.name = node.packageName || node.name
973+
if (node.packageName) {
974+
lock.name = node.packageName
975+
}
974976
if (node.version) {
975977
lock.version = node.version
976978
}

0 commit comments

Comments
 (0)