fix(core): fix the value check for publishConfig.provenance
#6781
+55
−0
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What's the problem this PR addresses?
This PR resolves an issue where the
publishConfig.provenance
field inpackage.json
wasn't being read correctly.Specifically:
publishConfig.provenance: true
was set inpackage.json
, Yarn'snpm publish
command wouldn't generate provenance statementsPublishConfig
interface hadprovenance?: boolean
defined, theload
method inManifest.ts
was missing the processing logic for theprovenance
field when handlingpublishConfig
access
,main
,module
,browser
,registry
,bin
,executableFiles
) were being processed correctly, butprovenance
was the only one being omittedHow did you fix it?
I added the following code to the
publishConfig
processing section within theload
method inpackages/yarnpkg-core/sources/Manifest.ts
:This fix ensures:
publishConfig.provenance
field inpackage.json
is read correctly when it's a boolean valueworkspace.manifest.publishConfig.provenance
npm publish
command (publish.ts
lines 109-120) functions properlyAdditionally, to ensure the accuracy of the fix, I added test cases to
packages/yarnpkg-core/tests/Manifest.test.ts
:provenance: true
is setprovenance: false
is setWith this fix, when
publishConfig.provenance
is configured inpackage.json
, provenance statements will be generated as expected.Checklist