fix(cli): add exports field to core-cli package.json#1775
Conversation
Fixes DEP0151 deprecation warnings on every import by declaring the entry point explicitly instead of relying on Node's default index.js resolution. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (3)
💤 Files with no reviewable changes (1)
✅ Files skipped from review due to trivial changes (2)
WalkthroughAdded an Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (2)
cli/package.json (2)
6-8: Consider adding a"main"field for backward compatibility.While the
"exports"field is the modern approach and resolves the DEP0151 warning, adding a"main"field alongside it would ensure compatibility with older Node.js versions and tools that don't yet support the"exports"field.📦 Optional: Add "main" field for broader compatibility
"type": "module", "exports": { ".": "./index.js" }, + "main": "./index.js", "bin": { "core-cli": "run.js" },🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@cli/package.json` around lines 6 - 8, Add a "main" field to package.json alongside the existing "exports" to provide backward compatibility for older Node.js versions and tools; specifically, add a "main": "./index.js" entry at the top-level so modules that rely on the legacy main entry point will still resolve to the same entry as the current "exports" mapping.
6-8: Consider if the wildcard export pattern is needed.The linked issue
#1774suggested a preferred solution that included a wildcard pattern:"./*": "./*.js". This would allow consumers to import subpaths directly (e.g.,import foo from '@fireproof/core-cli/foo.js').The current implementation only exports the package root. If the package is intended to have a restricted public API with only the root export, then the current approach is correct. However, if there are submodules that should be importable, consider adding the wildcard pattern.
🔧 Optional: Add wildcard pattern for subpath exports
"exports": { - ".": "./index.js" + ".": "./index.js", + "./*": "./*.js" },🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@cli/package.json` around lines 6 - 8, The package currently only exposes the package root via the "exports" field ("." -> "./index.js"); decide whether subpath imports should be allowed and if so add the wildcard export pattern `"./*": "./*.js"` to the same "exports" object so consumers can import submodules (e.g., '@fireproof/core-cli/foo.js'); otherwise keep the current restricted export but add a brief comment in package.json or README explaining the intentional single-entry export to document the choice.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@cli/package.json`:
- Around line 6-8: Add a "main" field to package.json alongside the existing
"exports" to provide backward compatibility for older Node.js versions and
tools; specifically, add a "main": "./index.js" entry at the top-level so
modules that rely on the legacy main entry point will still resolve to the same
entry as the current "exports" mapping.
- Around line 6-8: The package currently only exposes the package root via the
"exports" field ("." -> "./index.js"); decide whether subpath imports should be
allowed and if so add the wildcard export pattern `"./*": "./*.js"` to the same
"exports" object so consumers can import submodules (e.g.,
'@fireproof/core-cli/foo.js'); otherwise keep the current restricted export but
add a brief comment in package.json or README explaining the intentional
single-entry export to document the choice.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: c3a54b31-9fb4-4664-9a81-5b30fe673b50
📒 Files selected for processing (1)
cli/package.json
Node 24 ships with npm@11 built-in, fixing the broken `npm install -g npm@11` on Node 22.22.2 runners. Also aligns with GitHub's upcoming deprecation of Node 20 actions (June 2026). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Summary
"exports": { ".": "./index.js" }to@fireproof/core-clipackage.jsonnpx vibes-diyinvocationCloses #1774
Test plan
cd cli && pnpm test— 57/57 passnpm view @fireproof/core-cli@0.24.17 exportsnpx vibes-diy system🤖 Generated with Claude Code
Summary by CodeRabbit