Irregular support for semver engines


#1

It appears that Glitch has irregular support of the engines field in package.json files. By irregular, I mean it doesn’t support all valid semver ranges. Ranges like 8.x are supported, but not >=8.3.0

Is there a reason for this? If not, I would suggest using the production-ready semver module for resolving range queries. You could possible also use Heroku’s semver.io webservice to resolve queries.



https://docs.npmjs.com/misc/semver#ranges
https://semver.io/


#2

currently, the glitch package manager uses the semver-compare (https://www.npmjs.com/package/semver-compare) package to resolve whether your current package is less than the current latest stable version. It’s entirely possible it doesn’t support ranges well.

What use case are you seeing this be an issue for you?


#3

Thanks for getting back to me, @pketh. The problem is outlined well in the probot/template/pull/44 issue mentionde above.

This PR is about the error that Glitch throws i.e Node.js version >=7.7 is required. You have v6.13.1. on specifying node version ^8.0 or ^8.0.0 in package.json. I tried to use other versions like ^8.3.0 or something but it doesn’t seem to work. So far, 8.x works fine. :slight_smile:


#4

I took a look at semver-compare, and that’s definitely the cause of the issue. That module is designed to “compare two semver version strings”, not ranges.

I think the glitch package manager would be better off using the semver module, specifically semver.maxSatisfying(versions, range), which returns the highest version in a list of node version numbers that satisfies the given range. See https://github.com/npm/node-semver#ranges-1