arethetypeswrong / arethetypeswrong.github.io

Tool for analyzing TypeScript types of npm packages

Home Page:https://arethetypeswrong.github.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

`node-fetch` is no longer required

RobinTail opened this issue Β· comments

As of Node 18, fetch is within the globals:

https://dev.to/cloudx/nodejs-18-fetch-api-test-runner-module-and-more-2ckg

@types/node-fetch or lib: ["dom"] in tsconfig.json, however, might be required due to this issue (it's still experimental):

DefinitelyTyped/DefinitelyTyped#60924

Nevertheless, your amazing package requires Node 18 via one of its dependencies anyway:

marked@5.1.0: The engine "node" is incompatible with this module. Expected version ">= 18". Got "16.20.0"

=> Found "marked@5.1.0"
info Reasons this module exists
   - "@arethetypeswrong#cli" depends on it
   - Hoisted from "@arethetypeswrong#cli#marked"

, so I'd suggest to set

"engines": {
    "node": ">=18"
},

in package.json and remove node-fetch and fetch-ponyfill from the dependencies.

Does it actually fail in Node 16 due to marked, or is this just a warning? My intention is to support Node 16 until the end of its maintenance window, which is in... two weeks πŸ˜„

Hello @andrewbranch ,

Your package can not be installed in environment having Node 16 (at least without --ignore-engines flag of yarn) because of marked's constraints.

Here is was the output of my CI workflow when I tried:

### Run yarn install
yarn install v1.22.19
[1/5] Validating package.json...
[2/5] Resolving packages...
[3/5] Fetching packages...
error marked@5.1.0: The engine "node" is incompatible with this module. Expected version ">= 18". Got "16.20.0"
error Found incompatible module.
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
Error: Process completed with exit code 1.

Currently I'm going to drop Node 16 in my library, so I'm beginning using your package in my CI.

Correction, @andrewbranch , sorry:
I found out that later marked fixed this. It was >=18 in v5.1.0, but already in v5.1.2 they fixed it to >= 16.

Therefore, @andrewbranch , in order to support Node 16, I'd suggest to adjust the version of marked in your package.json:

- "marked": "^5.1.0"
+ "marked": "^5.1.2"

Perhaps I had this issue when marked 5.1.2 was not yet released, so it resolved to 5.1.0 when I tried to install your package.

I can confirm that at the moment there is no issue installing your package on Node 16:

$ yarn add @arethetypeswrong/cli
yarn add v1.22.11
[1/4] πŸ”  Resolving packages...
[2/4] 🚚  Fetching packages...
[3/4] πŸ”—  Linking dependencies...
[4/4] πŸ”¨  Building fresh packages...
success Saved lockfile.
success Saved 17 new dependencies.
info Direct dependencies
└─ @arethetypeswrong/cli@0.8.0
info All dependencies
β”œβ”€ @andrewbranch/untar.js@1.0.2
β”œβ”€ @arethetypeswrong/cli@0.8.0
β”œβ”€ @arethetypeswrong/core@0.8.0
β”œβ”€ @colors/colors@1.5.0
β”œβ”€ ansicolors@0.3.2
β”œβ”€ builtins@5.0.1
β”œβ”€ cardinal@2.1.1
β”œβ”€ commander@10.0.1
β”œβ”€ fetch-ponyfill@7.1.0
β”œβ”€ fflate@0.7.4
β”œβ”€ marked-terminal@5.2.0
β”œβ”€ marked@5.1.2
β”œβ”€ node-emoji@1.11.0
β”œβ”€ node-fetch@2.7.0
β”œβ”€ redeyed@2.1.1
β”œβ”€ tr46@0.0.3
└─ validate-npm-package-name@5.0.0
$ nvm current
v16.13.2

@andrewbranch

πŸŽ‰