redocly-cli icon indicating copy to clipboard operation
redocly-cli copied to clipboard

Chore: update dependencies to remove punycode depricated package

Open DmitryAnansky opened this issue 1 year ago • 4 comments

What/Why/How?

In order to eliminate punycode deprecated warning we need to switch from node-fetch package that has it as a transitive dependency.

$ NODE_OPTIONS='--trace-deprecation' redocly lint
(node:48436) [DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland alternative instead.
    at node:punycode:3:9
    at BuiltinModule.compileForInternalLoader (node:internal/bootstrap/realm:392:7)
    at BuiltinModule.compileForPublicLoader (node:internal/bootstrap/realm:328:10)
    at loadBuiltinModule (node:internal/modules/helpers:101:7)
    at Module._load (node:internal/modules/cjs/loader:1001:17)
    at Module.require (node:internal/modules/cjs/loader:1235:19)
    at require (node:internal/modules/helpers:176:18)
    at Object.<anonymous> (/opt/homebrew/lib/node_modules/@redocly/cli/node_modules/whatwg-url/lib/url-state-machine.js:2:18)
    at Module._compile (node:internal/modules/cjs/loader:1376:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1435:10)

It was decided to move to undici as it has full functionality and supports proxyAgent out of the box, comparing to native fetch (available from node version 18). But it comes at a price - this is going to be breaking change as requires to rise minimal nodeJS version to

"node": ">=18.17.0",

Screenshot 2024-10-08 at 15 56 49

Reference

Closes: https://github.com/Redocly/redocly-cli/issues/1332

Testing

  • [x] openapi-vscode

Screenshot 2024-10-08 at 17 54 08 Screenshot 2024-10-08 at 17 55 21 Screenshot 2024-10-08 at 17 55 33

  • [ ] monorepo
  • [ ] published portal verdaccio version in Reunite
  • [ ] workflows

Screenshots (optional)

Check yourself

  • [ ] Code changed? - Tested with redoc/reference-docs/workflows (internal)
  • [x] All new/updated code is covered with tests
  • [ ] New package installed? - Tested in different environments (browser/node)

Security

  • [x] Security impact of change has been considered
  • [x] Code follows company security practices and guidelines

DmitryAnansky avatar Oct 08 '24 13:10 DmitryAnansky

🦋 Changeset detected

Latest commit: 1f397dc50db38397b4b7abb3ef73cab78f0ffef2

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
@redocly/openapi-core Minor
@redocly/cli Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

changeset-bot[bot] avatar Oct 08 '24 13:10 changeset-bot[bot]

Command Mean [ms] Min [ms] Max [ms] Relative
redocly lint packages/core/src/benchmark/benches/rebilly.yaml 974.1 ± 19.4 952.0 1017.0 1.00
redocly-next lint packages/core/src/benchmark/benches/rebilly.yaml 993.3 ± 21.9 965.2 1034.7 1.02 ± 0.03

github-actions[bot] avatar Oct 08 '24 13:10 github-actions[bot]

Coverage report

St.:grey_question:
Category Percentage Covered / Total
🟡 Statements 78.57% 4996/6359
🟡 Branches 67.2% 2065/3073
🟡 Functions 72.98% 824/1129
🟡 Lines 78.86% 4714/5978
Show files with reduced coverage 🔻
St.:grey_question:
File Statements Branches Functions Lines
🟢
... / fetch-with-timeout.ts
91.67% 100% 50% 91.67%

Test suite run success

809 tests passing in 121 suites.

Report generated by 🧪jest coverage report action from 1f397dc50db38397b4b7abb3ef73cab78f0ffef2

github-actions[bot] avatar Oct 08 '24 13:10 github-actions[bot]

Going to test another approach with native fetch => https://github.com/Redocly/redocly-cli/pull/1763

DmitryAnansky avatar Oct 11 '24 16:10 DmitryAnansky