Skip to content

fix: add node version requirement#6

Closed
adollar28cents wants to merge 3 commits intoj9t:mainfrom
adollar28cents:node-version-support
Closed

fix: add node version requirement#6
adollar28cents wants to merge 3 commits intoj9t:mainfrom
adollar28cents:node-version-support

Conversation

@adollar28cents
Copy link
Copy Markdown

@adollar28cents adollar28cents commented Mar 25, 2026

Hi Jens,

I tried out this package on a computer using a very old version of node and it errored out when I ran it. I found that the null coalescing operator requires Node 14, so I updated my version and found these changes to the library that would alert users to this situation in the future if accepted.

Summary by CodeRabbit

  • Chores
    • Established and enforced a minimum Node.js version requirement of v14 or higher across the project with strict version validation to prevent runtime incompatibilities and ensure consistent development environments.
    • Updated project documentation and configuration to clearly communicate the required Node.js v14+ version to users before installation and usage of the project.

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Mar 25, 2026

Walkthrough

This pull request establishes Node.js version enforcement by adding an engines field to package.json specifying Node.js v14.0.0 or higher, enabling strict engine checking in .npmrc, and documenting the requirement in the README.

Changes

Cohort / File(s) Summary
Engine Enforcement Configuration
.npmrc, package.json
Added engine-strict=true to enforce npm engine checks and declared minimum Node.js version as >=14.0.0 via engines field.
Documentation
README.md
Added explicit Node.js v14+ requirement statement and corrected file formatting with proper newline termination.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'fix: add node version requirement' directly and concisely describes the main change: adding Node.js version requirements to the project configuration.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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 and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@package.json`:
- Around line 7-9: Update the package.json engines.node minimum to match the
Node APIs used: change the "engines.node" value from ">=14.0.0" to ">=18.17.0"
so runtime environments support AbortSignal.timeout(), parseArgs, and styleText;
locate the engines.node entry in package.json and replace the version string
accordingly and run a quick install/test to verify compatibility.

In `@README.md`:
- Line 5: Update the documented Node version and the package.json engines to
reflect the actual minimum required Node runtime: change the README text "Node
v14+" to "Node 20.12.0+ (or 21.7.0+ if you prefer a stable release without
experimental warnings)" and update the "engines" field in package.json from
">=14.0.0" to the chosen minimum (e.g., ">=20.12.0" or ">=21.7.0"); verify this
aligns with the import usage of styleText from node:util in bin/htaccess-punk.js
so the declared engine matches the runtime API used.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 9c5ddf00-50ee-4bc5-9553-c355aa3adf1b

📥 Commits

Reviewing files that changed from the base of the PR and between bca1f40 and 7785400.

📒 Files selected for processing (3)
  • .npmrc
  • README.md
  • package.json

Comment on lines +7 to +9
"engines" : {
"node" : ">=14.0.0"
},
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Verify runtime APIs used vs declared engine floor.
set -euo pipefail

echo "Declared engines:"
rg -n '"engines"|"node"' package.json -n -A2 -B1

echo
echo "AbortSignal.timeout usage:"
rg -nP '\bAbortSignal\.timeout\s*\(' -g '!**/node_modules/**'

echo
echo "parseArgs/styleText usage:"
rg -nP 'from\s+[\"\x27]node:util[\"\x27]|\\bparseArgs\\s*\\(|\\bstyleText\\s*\\(' -g '!**/node_modules/**'

echo
echo "CI node versions under test:"
rg -n 'node-version|matrix:|node:' .github/workflows -g '*.yml' -g '*.yaml'

Repository: j9t/htaccess-punk

Length of output: 485


🏁 Script executed:

# Check for parseArgs import and usage
echo "=== Checking for parseArgs import ==="
cat -n bin/htaccess-punk.js | head -20

echo -e "\n=== Checking for any 'node:util' imports ==="
rg "node:util|parseArgs|styleText" -n

echo -e "\n=== CI workflows node versions ==="
find .github/workflows -name "*.yml" -o -name "*.yaml" | head -5
cat .github/workflows/*.yml .github/workflows/*.yaml 2>/dev/null | grep -i "node" | head -20

Repository: j9t/htaccess-punk

Length of output: 2709


engines.node minimum is too low for APIs already used.

Line 8 declares >=14.0.0, but the codebase uses APIs that require significantly newer versions: AbortSignal.timeout() (Node 17.3+), parseArgs (Node 18.3+), and styleText (Node 18.17+). The lowest common floor is >=18.17.0. Raise the minimum to prevent runtime crashes on unsupported versions.

Suggested patch
-  "engines" : { 
-    "node" : ">=14.0.0"
+  "engines": {
+    "node": ">=18.17.0"
   },
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
"engines" : {
"node" : ">=14.0.0"
},
"engines": {
"node": ">=18.17.0"
},
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@package.json` around lines 7 - 9, Update the package.json engines.node
minimum to match the Node APIs used: change the "engines.node" value from
">=14.0.0" to ">=18.17.0" so runtime environments support AbortSignal.timeout(),
parseArgs, and styleText; locate the engines.node entry in package.json and
replace the version string accordingly and run a quick install/test to verify
compatibility.

[![npm version](https://img.shields.io/npm/v/htaccess-punk.svg)](https://www.npmjs.com/package/htaccess-punk) [![Build status](https://github.com/j9t/htaccess-punk/workflows/Tests/badge.svg)](https://github.com/j9t/htaccess-punk/actions) [![Socket](https://badge.socket.dev/npm/package/htaccess-punk)](https://socket.dev/npm/package/htaccess-punk)

.htaccess Punk checks the redirect targets defined in `.htaccess` files. It follows redirect chains to verify where they ultimately resolve and what HTTP status they return, thus helping to fight redirect rot.
.htaccess Punk checks the redirect targets defined in `.htaccess` files. It follows redirect chains to verify where they ultimately resolve and what HTTP status they return, thus helping to fight redirect rot. It requires Node v14+.
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

🏁 Script executed:

cat README.md | head -20

Repository: j9t/htaccess-punk

Length of output: 1050


🏁 Script executed:

cat package.json | head -50

Repository: j9t/htaccess-punk

Length of output: 1028


🏁 Script executed:

cat bin/htaccess-punk.js

Repository: j9t/htaccess-punk

Length of output: 3793


🏁 Script executed:

cat src/index.js

Repository: j9t/htaccess-punk

Length of output: 4308


🌐 Web query:

Node.js parseArgs util minimum version requirement

💡 Result:

The minimum Node.js version required to use the util.parseArgs function is v16.17.0 or v18.3.0. It was added as an experimental feature in these versions via PR #42675 (merged May 2022) and later stabilized.

Citations:


🌐 Web query:

Node.js fetch native API minimum version requirement

💡 Result:

The native Fetch API in Node.js is available starting from version 18.0.0, where it was introduced as an experimental feature enabled by default (disable with --no-experimental-fetch). It remained experimental through versions 18-20. In Node.js 21.0.0, Fetch was promoted to stable. As of 2026, all current LTS versions (20, 22, 24) and later include stable native Fetch with no flags required. For production use without experimental warnings or instability, the minimum recommended version is Node.js 21.

Citations:


🌐 Web query:

Node.js AbortSignal.timeout minimum version requirement

💡 Result:

Node.js AbortSignal.timeout requires Node.js version 16.14.0 or 17.3.0 minimum.

Citations:


🌐 Web query:

Node.js util.styleText minimum version requirement

💡 Result:

The minimum Node.js version required to use util.styleText is v20.12.0 or v21.7.0. It was added as a semver-minor feature in these releases via PR #51850, which merged on 2024-02-26. It is available (but experimental/unstable) in Node.js 20.12+ and 21.7+, became stable in v22.13.0 and v23.5.0. Prior versions like v18 and v21.0.0 do not have it. As of 2026-03-25, all maintained LTS versions (20, 22, 24) support it since v20.12.0.

Citations:


Documented and configured Node version is inaccurate.

Line 5 states Node v14+ and package.json specifies >=14.0.0, but the code uses styleText from node:util (imported in bin/htaccess-punk.js), which requires Node 20.12.0 or later. Update both the README and package.json engines field to reflect the actual minimum supported version: Node 20.12.0 (or 21.7.0+ if preferring a stable release without experimental warnings).

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@README.md` at line 5, Update the documented Node version and the package.json
engines to reflect the actual minimum required Node runtime: change the README
text "Node v14+" to "Node 20.12.0+ (or 21.7.0+ if you prefer a stable release
without experimental warnings)" and update the "engines" field in package.json
from ">=14.0.0" to the chosen minimum (e.g., ">=20.12.0" or ">=21.7.0"); verify
this aligns with the import usage of styleText from node:util in
bin/htaccess-punk.js so the declared engine matches the runtime API used.

@j9t
Copy link
Copy Markdown
Owner

j9t commented Mar 30, 2026

Thanks for filing this, @adollar28cents, much appreciated…! (Somehow I missed the notification, apologies for the delay.)

.htaccess Punk supports Node LTS as governed by the .nvmrc file. That is assumed to work.

Node 14 is long EOL, so I would not make special provisions for this.

I understand this means that in some cases, the tool cannot be used, but I do believe that Node LTS is a reasonably long ramp to strike a balance between offering solid support but also keeping the tech stack modern and focused.

Will close this one accordingly, but open to chat more! Thanks again for the PR!

@j9t j9t closed this Mar 30, 2026
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