Skip to content

Conversation

@varna
Copy link
Contributor

@varna varna commented Jul 2, 2024

#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:

  • Can automatically create a warning, when someone uses a wrong version
  • Automatically use defined Node version, when running project via pnpm
  • It will probably also be picked up by CI/CD

@varna varna requested a review from a team as a code owner July 2, 2024 09:37
Copy link
Contributor

@stepankuzmin stepankuzmin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch, thanks @varna 👍

@stepankuzmin stepankuzmin merged commit 61d64b8 into mapbox:main Jul 2, 2024
@mourner
Copy link
Member

mourner commented Jul 2, 2024

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
Copy link
Contributor Author

varna commented Jul 4, 2024

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
Copy link
Contributor Author

varna commented Jul 4, 2024

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).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants