fdir icon indicating copy to clipboard operation
fdir copied to clipboard

Set `engines` in `package.json`

Open NullPiotrException opened this issue 1 year ago • 8 comments

It would be nice to know which NodeJS versions are supported by fdir. All that needs to be done is to add the code below to package.json:

  "engines": {
    "node": ">= 16.0.0"
  }

I deduced version 16 based on testing NodeJS on CI here.

NullPiotrException avatar Sep 16 '24 08:09 NullPiotrException

Testing of 14 was removed in https://github.com/thecodrr/fdir/commit/3c608bd6c87d29534dd7b37a828db43ffcbf9ab3, but I don't think that actually introduced any new stuff; if the package really does support 14, it would be nice to declare that; mocha's engines are 14+ (as are TSs) so that would be sort of nice to have to replace glob or something.

Understandable if not.

jakebailey avatar Sep 16 '24 18:09 jakebailey

i believe that the library intentionally doesn't use newer node features to maintain compatibility, if the engines field is added it should reflect on what versions it works in even if testing on <14 was dropped

SuperchupuDev avatar Sep 25 '24 09:09 SuperchupuDev

If engines is set to v14 then CI must also add tests for node v14 to make sure things remain working and there are no breaking changes.

Update: the tests don't run on node@14. If anyone can make them work on node@14 that'd be good enough to add node 14 to engines.

thecodrr avatar Sep 26 '24 04:09 thecodrr

adding an engines field to anything above >=12.0.0 would be a breaking change for tinyglobby users btw, would it be possible to keep engines compatibility with node 12 at least during this major version?

SuperchupuDev avatar Sep 26 '24 14:09 SuperchupuDev

The version of vitest depended on in this repo only supports >=14.18, though I can't even seem to use that as something in the deps uses ||= somewhere.

The tests don't actually use any fancy features of vitest, so something simpler may be usable too, but I don't think this will be super simple. Not even vitest 0.1.0 supported Node 12.

jakebailey avatar Sep 26 '24 19:09 jakebailey

@thecodrr The feature 'AbortController' used in this commit breaks compatibility with Node 12. Is this what we expected?

godky avatar Jun 05 '25 02:06 godky

Er, well, no, given the package still doesn't declare which node versions it actually supports, and therefore it's assumed that it supports all of them.

The "right" way to do it would be to typeof AbortController !== "undefined" and then conditionally enable the feature, or similar.

EDIT: Oh, you mentioned me accidentally 😅

jakebailey avatar Jun 05 '25 02:06 jakebailey

Er, well, no, given the package still doesn't declare which node versions it actually supports, and therefore it's assumed that it supports all of them.

The "right" way to do it would be to typeof AbortController !== "undefined" and then conditionally enable the feature, or similar.

EDIT: Oh, you mentioned me accidentally 😅

Ah yes, I mentioned you by accident 😅. Thanks for your kind reply

godky avatar Jun 05 '25 03:06 godky

considering fdir started using AbortController recently, breaking compatibility with node 12 and 14, the engines field should probably be set to >=16.0.0 (despite being added in 14.17.0, AbortController was only unflagged in node 15.6.0, and using an odd numbered release for the engines field is likely not a good practice). the tests run on node 16 already so it shouldn't be a big deal. i'm considering adopting that range in tinyglobby SuperchupuDev/tinyglobby#134

SuperchupuDev avatar Jun 22 '25 14:06 SuperchupuDev

the engines.node field ended up getting set to >=12.0.0 in #159. i suppose this issue is solved now?

SuperchupuDev avatar Jul 08 '25 17:07 SuperchupuDev