Skip to content

Commit ec90f79

Browse files
committed
omitted name from package-lock.json
1 parent 7eca19c commit ec90f79

File tree

5 files changed

+7
-147
lines changed

5 files changed

+7
-147
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
@@ -985,7 +985,9 @@ class Shrinkwrap {
985985
#buildLegacyLockfile (node, lock, path = []) {
986986
if (node === this.tree) {
987987
// the root node
988-
lock.name = node.packageName || node.name
988+
if (node.packageName) {
989+
lock.name = node.packageName
990+
}
989991
if (node.version) {
990992
lock.version = node.version
991993
}

workspaces/arborist/tap-snapshots/test/arborist/reify.js.test.cjs

Lines changed: 4 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,6 @@ ArboristNode {
205205

206206
exports[`test/arborist/reify.js TAP add a new pkg to a prefix that needs to be mkdirpd not dry run > should place expected lockfile file into place 1`] = `
207207
{
208-
"name": "root",
209208
"lockfileVersion": 3,
210209
"requires": true,
211210
"packages": {
@@ -237,7 +236,6 @@ exports[`test/arborist/reify.js TAP add a new pkg to a prefix that needs to be m
237236
exports[`test/arborist/reify.js TAP add deps to workspaces add a to root > lockfile added workspace as dep 1`] = `
238237
Object {
239238
"lockfileVersion": 3,
240-
"name": "tap-testdir-reify-add-deps-to-workspaces-add-a-to-root",
241239
"packages": Object {
242240
"": Object {
243241
"dependencies": Object {
@@ -469,7 +467,6 @@ ArboristNode {
469467
exports[`test/arborist/reify.js TAP add deps to workspaces add mkdirp 0.5.0 to b > lockfile 1`] = `
470468
Object {
471469
"lockfileVersion": 3,
472-
"name": "tap-testdir-reify-add-deps-to-workspaces-add-mkdirp-0.5.0-to-b",
473470
"packages": Object {
474471
"": Object {
475472
"dependencies": Object {
@@ -768,7 +765,6 @@ ArboristNode {
768765
exports[`test/arborist/reify.js TAP add deps to workspaces add mkdirp 0.5.0 to b, empty start > lockfile 1`] = `
769766
Object {
770767
"lockfileVersion": 3,
771-
"name": "tap-testdir-reify-add-deps-to-workspaces-add-mkdirp-0.5.0-to-b-empty-start",
772768
"packages": Object {
773769
"": Object {
774770
"dependencies": Object {
@@ -979,7 +975,6 @@ ArboristNode {
979975
exports[`test/arborist/reify.js TAP add deps to workspaces no args > lockfile 1`] = `
980976
Object {
981977
"lockfileVersion": 3,
982-
"name": "tap-testdir-reify-add-deps-to-workspaces-no-args",
983978
"packages": Object {
984979
"": Object {
985980
"dependencies": Object {
@@ -1198,7 +1193,6 @@ ArboristNode {
11981193
exports[`test/arborist/reify.js TAP add deps to workspaces remove mkdirp from a > lockfile 1`] = `
11991194
Object {
12001195
"lockfileVersion": 3,
1201-
"name": "tap-testdir-reify-add-deps-to-workspaces-remove-mkdirp-from-a",
12021196
"packages": Object {
12031197
"": Object {
12041198
"dependencies": Object {
@@ -1355,7 +1349,6 @@ ArboristNode {
13551349
exports[`test/arborist/reify.js TAP add deps to workspaces remove mkdirp from a, empty start > lockfile 1`] = `
13561350
Object {
13571351
"lockfileVersion": 3,
1358-
"name": "tap-testdir-reify-add-deps-to-workspaces-remove-mkdirp-from-a-empty-start",
13591352
"packages": Object {
13601353
"": Object {
13611354
"dependencies": Object {
@@ -1472,7 +1465,6 @@ ArboristNode {
14721465
exports[`test/arborist/reify.js TAP add deps to workspaces upgrade mkdirp in a, dedupe on root > lockfile 1`] = `
14731466
Object {
14741467
"lockfileVersion": 3,
1475-
"name": "tap-testdir-reify-add-deps-to-workspaces-upgrade-mkdirp-in-a-dedupe-on-root",
14761468
"packages": Object {
14771469
"": Object {
14781470
"dependencies": Object {
@@ -1649,7 +1641,6 @@ ArboristNode {
16491641
exports[`test/arborist/reify.js TAP add deps to workspaces upgrade mkdirp in a, dedupe on root, empty start > lockfile 1`] = `
16501642
Object {
16511643
"lockfileVersion": 3,
1652-
"name": "tap-testdir-reify-add-deps-to-workspaces-upgrade-mkdirp-in-a-dedupe-on-root-empty-start",
16531644
"packages": Object {
16541645
"": Object {
16551646
"dependencies": Object {
@@ -3677,7 +3668,6 @@ ArboristNode {
36773668

36783669
exports[`test/arborist/reify.js TAP filtered reification in workspaces > hidden lockfile - c 1`] = `
36793670
{
3680-
"name": "tap-testdir-reify-filtered-reification-in-workspaces",
36813671
"lockfileVersion": 3,
36823672
"requires": true,
36833673
"packages": {
@@ -3704,7 +3694,6 @@ exports[`test/arborist/reify.js TAP filtered reification in workspaces > hidden
37043694

37053695
exports[`test/arborist/reify.js TAP filtered reification in workspaces > hidden lockfile - c, old x, removed a 1`] = `
37063696
{
3707-
"name": "tap-testdir-reify-filtered-reification-in-workspaces",
37083697
"lockfileVersion": 3,
37093698
"requires": true,
37103699
"packages": {
@@ -3738,7 +3727,6 @@ exports[`test/arborist/reify.js TAP filtered reification in workspaces > hidden
37383727

37393728
exports[`test/arborist/reify.js TAP filtered reification in workspaces > hidden lockfile - c, x 1`] = `
37403729
{
3741-
"name": "tap-testdir-reify-filtered-reification-in-workspaces",
37423730
"lockfileVersion": 3,
37433731
"requires": true,
37443732
"packages": {
@@ -3772,7 +3760,6 @@ exports[`test/arborist/reify.js TAP filtered reification in workspaces > hidden
37723760

37733761
exports[`test/arborist/reify.js TAP filtered reification in workspaces > hidden lockfile - c, x, a 1`] = `
37743762
{
3775-
"name": "tap-testdir-reify-filtered-reification-in-workspaces",
37763763
"lockfileVersion": 3,
37773764
"requires": true,
37783765
"packages": {
@@ -3832,7 +3819,6 @@ exports[`test/arborist/reify.js TAP filtered reification in workspaces > hidden
38323819

38333820
exports[`test/arborist/reify.js TAP filtered reification in workspaces > hidden lockfile - foo/x linked, c, old x, removed a 1`] = `
38343821
{
3835-
"name": "tap-testdir-reify-filtered-reification-in-workspaces",
38363822
"lockfileVersion": 3,
38373823
"requires": true,
38383824
"packages": {
@@ -4725,7 +4711,6 @@ exports[`test/arborist/reify.js TAP just the shrinkwrap cli-750-fresh > must mat
47254711

47264712
exports[`test/arborist/reify.js TAP just the shrinkwrap yarn-lock-mkdirp > must match snapshot 1`] = `
47274713
{
4728-
"name": "tap-testdir-reify-just-the-shrinkwrap-yarn-lock-mkdirp",
47294714
"lockfileVersion": 3,
47304715
"requires": true,
47314716
"packages": {
@@ -5141,40 +5126,6 @@ exports[`test/arborist/reify.js TAP modules bundled by the root should be instal
51415126

51425127
`
51435128

5144-
exports[`test/arborist/reify.js TAP move aside symlink clutter > must match snapshot 1`] = `
5145-
ArboristNode {
5146-
"children": Map {
5147-
"abbrev" => ArboristNode {
5148-
"edgesIn": Set {
5149-
EdgeIn {
5150-
"from": "",
5151-
"name": "abbrev",
5152-
"spec": "latest",
5153-
"type": "prod",
5154-
},
5155-
},
5156-
"location": "node_modules/abbrev",
5157-
"name": "abbrev",
5158-
"path": "{CWD}/test/arborist/tap-testdir-reify-move-aside-symlink-clutter/node_modules/abbrev",
5159-
"resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.1.1.tgz",
5160-
"version": "1.1.1",
5161-
},
5162-
},
5163-
"edgesOut": Map {
5164-
"abbrev" => EdgeOut {
5165-
"name": "abbrev",
5166-
"spec": "latest",
5167-
"to": "node_modules/abbrev",
5168-
"type": "prod",
5169-
},
5170-
},
5171-
"isProjectRoot": true,
5172-
"location": "",
5173-
"name": "tap-testdir-reify-move-aside-symlink-clutter",
5174-
"path": "{CWD}/test/arborist/tap-testdir-reify-move-aside-symlink-clutter",
5175-
}
5176-
`
5177-
51785129
exports[`test/arborist/reify.js TAP multiple bundles at the same level > must match snapshot 1`] = `
51795130
ArboristNode {
51805131
"children": Map {
@@ -18433,7 +18384,6 @@ exports[`test/arborist/reify.js TAP packageLockOnly can add deps > must match sn
1843318384

1843418385
exports[`test/arborist/reify.js TAP packageLockOnly can add deps > must match snapshot 2`] = `
1843518386
{
18436-
"name": "tap-testdir-reify-packageLockOnly-can-add-deps",
1843718387
"lockfileVersion": 3,
1843818388
"requires": true,
1843918389
"packages": {
@@ -33452,7 +33402,6 @@ exports[`test/arborist/reify.js TAP save package.json on update should not save
3345233402

3345333403
exports[`test/arborist/reify.js TAP save package.json on update should not save many deps in multiple package.json when using save=false > should update lockfile with many deps updated package.json save=false 1`] = `
3345433404
{
33455-
"name": "tap-testdir-reify-save-package.json-on-update-should-not-save-many-deps-in-multiple-package.json-when-using-save-false",
3345633405
"lockfileVersion": 3,
3345733406
"requires": true,
3345833407
"packages": {
@@ -33512,7 +33461,6 @@ exports[`test/arborist/reify.js TAP save package.json on update should not save
3351233461

3351333462
exports[`test/arborist/reify.js TAP save package.json on update should save many deps in multiple package.json when using save=true > should update lockfile with many deps updated package.json save=true 1`] = `
3351433463
{
33515-
"name": "tap-testdir-reify-save-package.json-on-update-should-save-many-deps-in-multiple-package.json-when-using-save-true",
3351633464
"lockfileVersion": 3,
3351733465
"requires": true,
3351833466
"packages": {
@@ -33572,7 +33520,7 @@ exports[`test/arborist/reify.js TAP save package.json on update should save many
3357233520

3357333521
exports[`test/arborist/reify.js TAP save package.json on update should update named dep across multiple package.json using save=true > should update lockfile with many deps updated package.json save=true 1`] = `
3357433522
{
33575-
"name": "tap-testdir-reify-save-package.json-on-update-should-update-named-dep-across-multiple-package.json-using-save-true",
33523+
"name": "workspaces-need-update",
3357633524
"lockfileVersion": 2,
3357733525
"requires": true,
3357833526
"packages": {
@@ -33663,7 +33611,7 @@ exports[`test/arborist/reify.js TAP save package.json on update should update na
3366333611

3366433612
exports[`test/arborist/reify.js TAP save package.json on update should update single named dep across multiple package.json using save=true > should update lockfile with single dep updated package.json save=true 1`] = `
3366533613
{
33666-
"name": "tap-testdir-reify-save-package.json-on-update-should-update-single-named-dep-across-multiple-package.json-using-save-true",
33614+
"name": "workspaces-need-update",
3366733615
"lockfileVersion": 2,
3366833616
"requires": true,
3366933617
"packages": {
@@ -33754,7 +33702,6 @@ exports[`test/arborist/reify.js TAP save package.json on update should update si
3375433702

3375533703
exports[`test/arborist/reify.js TAP save proper lockfile with bins when upgrading lockfile complete=false > should upgrade, with bins in place 1`] = `
3375633704
{
33757-
"name": "tap-testdir-reify-save-proper-lockfile-with-bins-when-upgrading-lockfile-complete-false",
3375833705
"lockfileVersion": 3,
3375933706
"requires": true,
3376033707
"packages": {
@@ -33782,7 +33729,6 @@ exports[`test/arborist/reify.js TAP save proper lockfile with bins when upgradin
3378233729

3378333730
exports[`test/arborist/reify.js TAP save proper lockfile with bins when upgrading lockfile complete=true > should upgrade, with bins in place 1`] = `
3378433731
{
33785-
"name": "tap-testdir-reify-save-proper-lockfile-with-bins-when-upgrading-lockfile-complete-true",
3378633732
"lockfileVersion": 3,
3378733733
"requires": true,
3378833734
"packages": {
@@ -33819,7 +33765,6 @@ exports[`test/arborist/reify.js TAP saveBundle > must match snapshot 1`] = `
3381933765
exports[`test/arborist/reify.js TAP saving the ideal tree save some stuff > lock after save 1`] = `
3382033766
Object {
3382133767
"lockfileVersion": 3,
33822-
"name": "tap-testdir-reify-saving-the-ideal-tree-save-some-stuff",
3382333768
"packages": Object {
3382433769
"": Object {
3382533770
"bundleDependencies": Array [
@@ -47645,7 +47590,7 @@ mkdirp@^1.0.2:
4764547590

4764647591
exports[`test/arborist/reify.js TAP warn and correct if damaged data in lockfile first pass logs > "fixed" lockfile 1`] = `
4764747592
{
47648-
"name": "tap-testdir-reify-warn-and-correct-if-damaged-data-in-lockfile",
47593+
"name": "garbage-in-reify-tree",
4764947594
"lockfileVersion": 2,
4765047595
"requires": true,
4765147596
"packages": {
@@ -47661,7 +47606,7 @@ exports[`test/arborist/reify.js TAP warn and correct if damaged data in lockfile
4766147606

4766247607
exports[`test/arborist/reify.js TAP warn and correct if damaged data in lockfile second pass just does the right thing > actually fixed lockfile 1`] = `
4766347608
{
47664-
"name": "tap-testdir-reify-warn-and-correct-if-damaged-data-in-lockfile",
47609+
"name": "garbage-in-reify-tree",
4766547610
"lockfileVersion": 2,
4766647611
"requires": true,
4766747612
"packages": {

0 commit comments

Comments
 (0)