feat: modernize deps, replace spdy with node:http2, migrate CI to GitHub Actions - #17
feat: modernize deps, replace spdy with node:http2, migrate CI to GitHub Actions#17FacePlant101 wants to merge 6 commits into
Conversation
…Hub Actions
- Replace spdy (broken on Node 22+) with built-in node:http2 for HTTPS
- Replace cookie-manager with @juji/cookie-manager (drop-in, npm deprecated original)
- Bump chalk ^2.3.0 -> ^4.1.2 (last CJS version)
- Bump normalize-url ^1.9.0 -> ^5.3.1 (last CJS version, add sortQueryParameters: false)
- Bump readable-stream ^2.3.3 -> ^4.7.0
- Bump standard ^9.0.2 -> ^17.1.2, tape ^4.8.0 -> ^5.10.2
- Migrate url.parse() to new URL()
- Migrate util.inherits() to class extends
- Remove Trace.setProtocol() (protocol known statically per code path)
- Add engines: { node: '>=18' }
- Remove .travis.yml, add .github/workflows/ci.yml (Node 18, 20, 22 matrix)
- Fix all standard v17 lint errors (var -> const/let, object shorthand)
Co-Authored-By: Aleksander Vassdal <aleksander.vassdal@gmail.com>
NYT (nyti.ms) now blocks HEAD requests with 403, same as Twitter (t.co) which was already skipped. This is a server-side change, not a code bug. Co-Authored-By: Aleksander Vassdal <aleksander.vassdal@gmail.com>
- Fix redirect handling: resolve relative Location headers against the current URL using new URL(location, currentUrl).href - Replace broken test URLs (NYT returns 403, Twitter already skipped) with google.com which reliably returns 200 and sets cookies - All tests now pass with no skips Co-Authored-By: Aleksander Vassdal <aleksander.vassdal@gmail.com>
Node 18 and 20 are EOL/deprecated. Update CI matrix to current supported versions and bump engines accordingly. Co-Authored-By: Aleksander Vassdal <aleksander.vassdal@gmail.com>
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
|
Warning Review the following alerts detected in dependencies. According to your organization's Security Policy, it is recommended to resolve "Warn" alerts. Learn more about Socket for GitHub.
|
Remove the stale third-party dependency and inline a minimal Cookies class (~35 lines) that covers the same surface: store(), prepare(), and length. No behaviour change; all 14 tests pass. Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Summary
The
spdypackage hard-crashes on Node 22+ (process.binding('http_parser')removed), making the CLI completely broken on modern Node. This PR replaces it with the built-innode:http2module, modernizes all dependencies to their latest CJS-compatible versions, and removes the stale@juji/cookie-managerdependency entirely.Key changes
lib/trace.jsrewrite —spdy→node:http2:The old code used
spdy.createAgent()for all HTTPS requests. Now HTTPS and HTTP use separate code paths:_followH2opens anhttp2.connect(origin)session, sendsHEADviasession.request(), and maps the HTTP/2 response:statusCode←:statuspseudo-headerstatusMessage←''(HTTP/2 has no reason phrase)httpVersionMajor/Minor←2/0headers← response headers with pseudo-headers strippedTrace.setProtocol()removed — protocol is known statically per code path.Other code changes:
url.parse()→new URL()(avoids DEP0169 deprecation)util.inherits()→class Trace extends Stream.Readable@juji/cookie-managerremoved — replaced with an inlineCookiesclass (~35 lines) coveringstore(),prepare(), andlengthnormalizeUrl()call gainssortQueryParameters: false(v5 sorts by default, v1 did not)_setCookiebug: was always storingheaders['set-cookie'][0]in the loop instead of[i]Locationheaders against current URL usingnew URL(location, currentUrl).hrefDependency bumps:
spdy^3.4.4cookie-manager/@juji/cookie-manager^0.0.19chalk^2.3.0^4.1.2normalize-url^1.9.0^5.3.1readable-stream^2.3.3^4.7.0standard^9.0.2^17.1.2tape^4.8.0^5.10.2Tests: Replaced broken test URLs (NYT returns 403, Twitter was already skipped) with
google.comwhich reliably returns 200. All tests pass with 0 skips.CI: Travis CI (
.travis.yml) → GitHub Actions (Node 22, 24, 26 matrix).engines: Added"node": ">=22".All
standardv17 lint warnings fixed (var→const/let, object shorthand).Link to Devin session: https://app.devin.ai/sessions/31e62f90db4c4e19a7a1eed5302f18e8
Requested by: @avassdal