Elius94 / console-gui-tools

A simple library to draw option menu or other popup inputs and layout on Node.js console.
MIT License
111 stars 17 forks source link

Set up Typescript environment to build project for both es2022 and commonjs #38

Closed Elius94 closed 2 years ago

Elius94 commented 2 years ago

Hi, I just say this issue. I actually had to convert my project from CJS to ESM when I installed your library. Does converting it all to Typescript mean that my program will break again if it is not converted back?

Originally posted by @lather205 in https://github.com/Elius94/console-gui-tools/issues/35#issuecomment-1131931655

Elius94 commented 2 years ago

I have noticed that the current best practices of nodejs library creation, recommend to implement only in ES6 mode as it is fully supported by Node and fully implementable. I recommend that you set your code in ES6 or alternatively download my library and compile it individually for yourself. You just need to change the tsconfig.json to "module": "commonjs" and then with npm pack you can package everything for your projects.

Elius94 commented 2 years ago

Yes! By changing your project to ESM you are ok 👌 thanks

Elius94 commented 1 year ago

Hello @lather205 ! After several months I changed the build method and now one package is generated for CJS and one for ESM. Node is able to determine by itself which one to import based on your package.json.