Skip to content

Conversation

@pyramation
Copy link
Contributor

@pyramation pyramation commented Dec 13, 2025

fix(find-and-require-package-json): require callerDir parameter to find correct package.json

Summary

BREAKING CHANGE: findAndRequirePackageJson() now requires a callerDir parameter.

The previous implementation used __dirname internally, which always pointed to the find-and-require-package-json package's own directory. This caused any package calling this function to incorrectly identify itself as [email protected] instead of its actual name/version.

This was discovered via CI failures in constructive PR #393 where plugins were reporting errors like:

Plugin [email protected] requires graphile-plugin-connection-filter@^2.0.0 (not found)

Now callers must pass their own __dirname (CJS) or dirname(fileURLToPath(import.meta.url)) (ESM).

Updates since last revision

  • Fixed inquirerer package (internal consumer in this repo) to pass __dirname to findAndRequirePackageJson() - this was causing CI build failures

Review & Testing Checklist for Human

  • Update all consumers in constructive repo - Multiple packages use this function and will break: graphile-plugin-connection-filter-postgis, graphile-plugin-connection-filter, graphile-many-to-many, graphile-postgis, packages/cli, packages/pgpm
  • Verify fix resolves constructive CI failures - After updating consumers, re-run the failing tests in constructive PR #393 to confirm the root cause is fixed
  • Verify version bump is appropriate - Bumped to 0.7.0 for breaking change in pre-1.0 semver

Recommended test plan:

  1. Publish this package (or link locally)
  2. Update all call sites in constructive to pass __dirname
  3. Re-run the failing CI jobs for packages/introspectron and packages/launchql-gen

Notes

…nd correct package.json

BREAKING CHANGE: findAndRequirePackageJson() now requires a callerDir parameter.

Previously, the function used __dirname internally which always pointed to the
find-and-require-package-json package's own directory, causing it to return
the wrong package.json when called from other packages.

Now callers must pass their own __dirname (CJS) or
dirname(fileURLToPath(import.meta.url)) (ESM) to find the correct package.json.

Fixes CI failures in constructive repo where plugins were incorrectly
identified as '[email protected]' instead of their actual names.

Co-Authored-By: Dan Lynch <[email protected]>
@devin-ai-integration
Copy link

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants