Skip to content

fix: correct engines.node floor to reflect actual styleText requirement - #583

Merged
toiroakr merged 4 commits into
mainfrom
fix/engines-node-version
Jul 7, 2026
Merged

toiroakr merged 4 commits into
mainfrom
fix/engines-node-version

Conversation

@dqn

@dqn dqn commented Jul 3, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Fix the declared minimum Node version so npm install politty no longer produces a package that crashes on import. Also updated the README's Requirements section to match the corrected engines.node range.

Root cause

The logger uses node:util's styleText, added in Node 20.12.0 / 21.7.0. engines.node claimed >=18, so installs on Node 18–20.11 succeeded but import "politty" failed immediately:

SyntaxError: The requested module 'node:util' does not provide an export named 'styleText'

Verification

  • Reproduced the crash on Node 20.11.0, confirmed a clean load on Node 20.12.0 after the fix.
  • Build target (tsdown.config.ts) updated from node18 to node20.12 to match.

Code Metrics Report

main (b5f0d81) #583 (69110a6) +/-
Coverage 91.9% 91.9% 0.0%
Test Execution Time 15s 14s -1s
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

  • Chores
    • Updated the minimum supported Node.js version to 20.12.0.
    • Aligned build settings with the newer runtime target for better compatibility.
    • Adjusted release metadata to reflect the updated runtime requirements.

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.
@coderabbitai

coderabbitai Bot commented Jul 3, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

This 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.

Changes

Node Version Bump

Layer / File(s) Summary
Engine and build target update
package.json, tsdown.config.ts, .changeset/silly-mice-jump.md
engines.node raised to >=20.12.0 and build target changed to node20.12, with a changeset noting the patch aligns requirements with node:util's styleText availability.

Estimated code review effort: 1 (Trivial) | ~3 minutes

Poem

A hop, a skip, a version leap,
Node twenty-twelve, no more asleep 🐇
styleText now has room to play,
Old node18 must hop away!
Patch notes penned, the burrow's set,
Onward we bound, no regret.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly matches the main change: raising the Node.js floor to match the styleText dependency.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/engines-node-version

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@pkg-pr-new

pkg-pr-new Bot commented Jul 3, 2026 •

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/politty@0c609de

commit: 0c609de

@dqn
dqn marked this pull request as ready for review July 3, 2026 17:04
@dqn
dqn requested a review from toiroakr July 3, 2026 17:04

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

📥 Commits

Reviewing files that changed from the base of the PR and between f364eb9 and fd67602.

📒 Files selected for processing (3)
  • .changeset/silly-mice-jump.md
  • package.json
  • tsdown.config.ts
📜 Review details
🔇 Additional comments (2)
tsdown.config.ts (1)

21-21: LGTM!

.changeset/silly-mice-jump.md (1)

1-6: LGTM!

Comment thread package.json Outdated

@toiroakr toiroakr left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@toiroakr
toiroakr merged commit 403a37e into main Jul 7, 2026
12 of 13 checks passed
@toiroakr
toiroakr deleted the fix/engines-node-version branch July 7, 2026 14:31
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