fix: read correct package.json
with read-pkg.sync
#890
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.
Description
This corrects the
read-pkg.sync()
usage, providing the current working directory in the argument formatread-pkg.sync()
expects.Motivation and Context
Fixes #887.
The
read-pkg
dependency upgrade (a876fb8) tov5.2.0
introduced an issue becauseread-pkg.sync
's API introduced a breaking change. In v3.0.0read-pkg.sync()
accepts the filepath as the first argument. In v5.2.0,read-pkg.sync()
accepts an object as its first argument, where thecwd
key contains the filepath. See here.As
commitlint
did not provide acwd
key, theread-pkg.sync()
defaults to readingpackage.json
from the current working directory.Usage examples
How Has This Been Tested?
After setting up the local development environment, I reproduced the issue against
master
in a temporary directory. I then changed to thefix-read-pkg-v5-usage
branch and re-ran the test case with success.From within the git repository:
Types of changes
Checklist: