Repository navigation
fix: correct engines.node floor to reflect actual styleText requirement - #583
Conversation
node:util's styleText, used by the logger, was added in Node 20.12.0 / 21.7.0. The declared >=18 floor allowed installs that crashed on import on Node 18-20.11. Reproduced the crash on Node 20.11.0 and confirmed a clean load on 20.12.0 after the fix. Also aligns the tsdown build target with the new floor.
📝 WalkthroughWalkthroughThis PR raises the minimum required Node.js version from >=18 to >=20.12.0 in package.json, updates the tsdown build target from node18 to node20.12, and adds a changeset documenting the patch to align runtime requirements with usage of node:util's styleText. ChangesNode Version Bump
Estimated code review effort: 1 (Trivial) | ~3 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 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 |
commit: |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@package.json`:
- Line 120: The Node engine range in package.json still allows Node
21.0.0–21.6.x even though styleText is only available starting in 21.7.0. Update
the engines.node entry to use a split range that keeps support for >=20.12.0
while excluding the unsupported 21.0.0–21.6.x versions, and make sure the
package.json engine declaration reflects that constraint clearly.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 51ebb84e-2ceb-41f6-87ab-3ec0854d0e91
📒 Files selected for processing (3)
.changeset/silly-mice-jump.mdpackage.jsontsdown.config.ts
📜 Review details
🔇 Additional comments (2)
tsdown.config.ts (1)
21-21: LGTM!.changeset/silly-mice-jump.md (1)
1-6: LGTM!
toiroakr
left a comment
There was a problem hiding this comment.
Looks good — root cause and fix are correct (styleText requires Node 20.12.0/21.7.0), and the semver range for engines.node properly excludes the unsupported Node 21.0.0–21.6.x window.
I pushed one follow-up commit updating README.md's Requirements section (Node.js >= 18 → >=20.12.0, excluding 21.0.0–21.6.x) so the documented requirement matches the corrected engines.node. Approving and merging.
# Conflicts: # package-lock.json
Summary
Fix the declared minimum Node version so
npm install polittyno longer produces a package that crashes on import. Also updated the README's Requirements section to match the correctedengines.noderange.Root cause
The logger uses
node:util'sstyleText, added in Node 20.12.0 / 21.7.0.engines.nodeclaimed>=18, so installs on Node 18–20.11 succeeded butimport "politty"failed immediately:Verification
tsdown.config.ts) updated fromnode18tonode20.12to match.Code Metrics Report
Details
| | main (b5f0d81) | #583 (69110a6) | +/- | |---------------------|----------------|----------------|------| | Coverage | 91.9% | 91.9% | 0.0% | | Files | 72 | 72 | 0 | | Lines | 7666 | 7666 | 0 | | Covered | 7048 | 7048 | 0 | + | Test Execution Time | 15s | 14s | -1s |Reported by octocov
Summary by CodeRabbit