fix(core): fix the value check for publishConfig.provenance
#6781
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.provenancefield inpackage.jsonwasn't being read correctly.Specifically:
publishConfig.provenance: truewas set inpackage.json, Yarn'snpm publishcommand wouldn't generate provenance statementsPublishConfiginterface hadprovenance?: booleandefined, theloadmethod inManifest.tswas missing the processing logic for theprovenancefield when handlingpublishConfigaccess,main,module,browser,registry,bin,executableFiles) were being processed correctly, butprovenancewas the only one being omittedHow did you fix it?
I added the following code to the
publishConfigprocessing section within theloadmethod inpackages/yarnpkg-core/sources/Manifest.ts:This fix ensures:
publishConfig.provenancefield inpackage.jsonis read correctly when it's a boolean valueworkspace.manifest.publishConfig.provenancenpm publishcommand (publish.tslines 109-120) functions properlyAdditionally, to ensure the accuracy of the fix, I added test cases to
packages/yarnpkg-core/tests/Manifest.test.ts:provenance: trueis setprovenance: falseis setWith this fix, when
publishConfig.provenanceis configured inpackage.json, provenance statements will be generated as expected.Checklist