medic / cht-conf

A command-line interface for configuring Community Health Toolkit applications
https://communityhealthtoolkit.org
GNU Affero General Public License v3.0
23 stars 25 forks source link

Migrate cht-conf to ESM #627

Open m5r opened 1 month ago

m5r commented 1 month ago

Describe the issue ESM is the standard way of packaging code in Node (and in the browser, but not relevant to cht-conf). Packages we depend on are becoming ESM-only and we need to move away from CJS if we don't want to fall behind again.

Describe the improvement you'd like Needs double-checking but end users of cht-conf won't see a difference since it's a CLI and not a module they import in their code. So it shouldn't need to be a new major version.

Migration path: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c#how-can-i-move-my-commonjs-project-to-esm https://tsmx.net/convert-existing-nodejs-project-from-commonjs-to-esm/

Describe alternatives you've considered Stick to CJS and await import("module") ESM-only code. That doesn't scale very well.