maxlath / wikibase-edit

a lib to edit Wikibase from NodeJS
67 stars 25 forks source link

bump node version to latest LTS (12.13.1) #46

Closed SirkoS closed 4 years ago

SirkoS commented 4 years ago

Currently, the package.json shows a supported node version of 6.4:

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

That version is from 2016-08-12 (see here). I think (hope) that nobody is using a version that old anymore. It also ran out of support long ago.

Can you please update the supported node version to the latest LTS version (12)? The previous LTS version (10) will go in maintenance mode rather soon (April 2020), so I don't think there is a great need to support that.

As I'm currently trying to write a patch for #37 , I would like to make use of some of the features that landed later on. In particular, async/await makes the code much more readable in my eyes (is supported by node since 7.6.0).

maxlath commented 4 years ago

I would be open to introducing async/await but we would just need to change the engine to >= 7.6 then, no?

SirkoS commented 4 years ago

For async/await this would be enough, but what's the point of supporting such old versions? One could also set up a babel build to support them, if necessary.

I'm just so used to the more modern features that it is quite hard to always think about when this was actually introduced.

maxlath commented 4 years ago

I give you a very concrete example: inventaire (the primary reason wikibase-edit exists ;)) is blocked on NodeJS v8 until one of your dependency allows upgrading. I guess there are other cases of this kind where people are hold back by different dependencies needs, and then always being on the edge is not a very friendly move... I would be of the opinion that the latest version of wikibase-edit should be at least support the currently maintained oldest LTS. People stuck on even older versions of Node (that sucks but it happens) would then be advised to use a compatible previous major version.

SirkoS commented 4 years ago

Fair point (although the dependency you linked seems dead and you should maybe look for a replacement).

So 7.6 for async/await would still be ok, right?

I also get, that Babel is also not really an option for you?

maxlath commented 4 years ago

(I was about to start mourning this dependency, when it started showing signs of a rebirth :D)

Yes, moving to engine.node = >= 7.6 sounds acceptable if it can increase the code readability, but that's a subjective point and I'm not sold on async/await (yet), so please don't go into rewriting the whole module with a new syntax ;) Changing the minimum engine would be a breaking change for the newly unsupported versions, so that would mean releasing a major version (which is totally ok)

As for Babel, the more we can avoid relying on this kind of tool chain, the better for everyone in terms of limiting having to install and keep updated thousands of dependencies.

SirkoS commented 4 years ago

I finished my first pass for removing the bluereq dependency [1]. While testing on node 6.4, I noticed something: the current version is not supporting node 6.4, but actually requires at least 7.0. lib/resolve_title.js makes use of Object.values(), which was introduced in node 7.0 (or 6.5, if you use the --harmony flag):

const parsePrefixesMap = res => {
  return Object.values(res.query.namespaces)
  .filter(namespace => namespace.defaultcontentmodel)
  .filter(namespace => namespace.defaultcontentmodel.startsWith('wikibase'))
  .reduce(aggregatePrefixes, {})
}

[1] https://github.com/SirkoS/wikibase-edit OAuth probably not working right now, but hard to say without tests (#40). I'll do the pull request, when I could check the OAuth support.

maxlath commented 4 years ago

OAuth has been the most blocking point for me on my research to get beyond request (and the packages that are just wrappers of it such as bluereq): it does seem to be doing a lot in the background

maxlath commented 4 years ago

another argument in favour of staying on v8, currently the oldest LTS, is that it is the one available from Wikimedia Toolforge servers

maxlath commented 4 years ago

I published wikibase-edit v4.0.0, which now requires node >= v7.6.0, to allow the use of async/await

maxlath commented 4 years ago

@SirkoS follow-up on this discussion: I'm now largely in favor of async/await, thanks for pushing it :D