fix: pass __dirname to findAndRequirePackageJson for correct package.json resolution #393
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.
Summary
Updates all call sites of
findAndRequirePackageJson()to pass__dirnameas a required parameter. This fixes a bug where the function was finding the wrong package.json (the helper package's own package.json instead of the caller's).The root cause was that
__dirnameinside the helper function pointed to the compiled helper's location (node_modules/find-and-require-package-json/dist/), not the caller's location. This caused errors like:Updated packages:
Also includes dependency version bumps (pg, @types/pg, lru-cache, etc.) and adds
find-and-require-package-json@^0.8.0as a dependency to the affected graphile packages.Review & Testing Checklist for Human
find-and-require-package-json's version)pgpm --versionandlql --versioncommands return correct package versionsRecommended test plan: Run the graphile plugins in a test environment and verify the version checking logic works correctly (e.g., the "requires graphile-build-pg@^4.4.0" dependency check should pass).
Notes
Related PR: constructive-io/dev-utils#19 (fix in find-and-require-package-json package)
Link to Devin run: https://app.devin.ai/sessions/69206214490a4b479dabb13c55a4a44f
Requested by: Dan Lynch ([email protected]) / @pyramation