mapbox / mapbox-gl-draw

Draw tools for mapbox-gl-js
https://www.mapbox.com/mapbox-gl-js/example/mapbox-gl-draw/
ISC License
940 stars 590 forks source link

chore: Update package.json to Node.js version 18.0.0 or higher #1248

Closed varna closed 2 months ago

varna commented 2 months ago

https://github.com/mapbox/mapbox-gl-draw/pull/1242 switched project to Vite and ESM. This means that this project currently supports node version ^18.0.0 || >=20.0.0 https://vitejs.dev/guide/#scaffolding-your-first-vite-project

By adding engines.node to package.json we gain some extra features:

mourner commented 2 months ago

Note that this requirement is only for local development of mapbox-gl-draw — downstream consumers that bundle mapbox-gl-draw in their apps don't have to adhere to the requirement. This is why I've been avoiding specifying engines for such projects. Not sure if we want to keep it.

varna commented 2 months ago

Oh well, then shall we go with .nvmrc instead? @mourner

I thought engines was not enforced without engines-strict. And vite has engines set too. So downstream user would need to use Draw as dev dependency anyway then (and bundler). Or via CDN. In theory Draw should work with node14 (es2020). But node18 is actually the latest maintained version (and the one used by Vite), so I wouldn't recommend using anything older.

image

varna commented 2 months ago

Actually, this project doesn't even really need Node to run. Currently only dependence is probably node test runner. It should be easy to replace it with Vitest. Then you could use this as ES on anything (Node, Bun or Deno).