Closed benma closed 3 years ago
@thisconnect should we commit the compiled lib/
folder as well? So it is clear what the code is that is published instead of it being generated at publish-time.
Seems people don't usually do this, but it feels strange to me not to commit it.
I played around with https://nodejs.org/api/packages.html#packages_conditional_exports and tested if we could ship both ES5 and ES6. But then realized that the generated src/bitbox02-api-go.js
is ES5 anyways (looks like AMD?) and the entry file uses import/export, this wont work purely with native import
.
Let's just ship commonjs ES5 with require
as you do in the PR, but make it a major version bump?
We could npm version next
, so api consumers could test bitbox02-api@next
... or we just make it a major version bump. (see about publishing beta verison https://docs.npmjs.com/cli/v7/commands/npm-dist-tag#purpose)
@thisconnect I added 'files' and dropped '.npmignore', PTAL.
@thisconnect I now also commit the transpiled lib/
and check in CI that it derives from src/. This way, we know the lib/ is always ready to be published and up to date, which seems more robust than hoping that it runs correctly (or at all) when publishing.
It is easier to use for downstream projects if this module is transpiled to ES5 syntax. E.g. in MetaMask, we couldn't figure out how to add this library as a dependency without it being ES5.
When using the transpiled code in MyEtherWallet, everything works, but there is this new warning:
This file is copied as is without changes, so it is not clear why this warning would appear now.