ethereumjs / ethereumjs-tx

Project is in active development and has been moved to the EthereumJS VM monorepo.
https://github.com/ethereumjs/ethereumjs-vm/tree/master/packages/tx
Mozilla Public License 2.0
781 stars 237 forks source link

Adds es5 (babel) build script and folder #62

Closed tinybike closed 7 years ago

tinybike commented 7 years ago

I believe this fixes #59 and fixes #53. I have this npm linked locally for the sake of avoiding a special compilation step for ethereumjs-tx in our dependent repos. Sending this PR in case it can be helpful to others.

coveralls commented 7 years ago

Coverage Status

Changes Unknown when pulling 868ec209d2b95c8bc6c5ee4597696531944a221d on tinybike:master into on ethereumjs:master.

fanatid commented 7 years ago

in case if somebody going to merge this... can we ignore es5 folder for git?

tinybike commented 7 years ago

@fanatid I'm not attached at all to this particular way of solving the problem. I'm sure there's a way of doing this that doesn't require putting the es5 source file in the repo. I'm just not so good at compilation/build-system stuff so I don't know how!

wanderer commented 7 years ago

hmm @tinybike im not sure this is the best solution either. But I can't propose a better one... not sure what to do here yet

MicahZoltu commented 7 years ago

You can .gitignore the es5 folder but not .npmignore it. That way when you publish, it publishes the generated files. You can see that in ethereumjs-blockstream, notice that the output folder is empty. When you compile it will fill that folder and npmpublish will publish its contents (along with the original TS files for source mapping and auto-complete).

tinybike commented 7 years ago

That makes sense -- ok, just pushed updated .gitignore and .npmignore. Let me know if this PR needs other changes; I'd like to add this repo back to our normal workflow!

coveralls commented 7 years ago

Coverage Status

Changes Unknown when pulling 2b01ff37e3dc746e16ea9f83be5111e06b8f7a3b on tinybike:master into on ethereumjs:master.

fanatid commented 7 years ago

@tinybike you also can pass * to only flag (in babel), then ethereumjs-tx and other node_modules will be compiled to es5 on fly

tinybike commented 7 years ago

@fanatid Right, as I understand it the issue is that ES5-only repos don't normally have babel as part of their build process. IMO it's a good practice for ES6 libraries to publish ES5 versions so that ES5 projects with ethereumjs-tx as a dependency don't have to include babel in their toolchain just for ethereumjs-tx.

@wanderer Let me know if you'd prefer not to have ES5 code as part of this repo at all -- I can just publish a separate ethereumjs-tx-es5 package on npm.

wanderer commented 7 years ago

@tinybike ok i think it looks good now thanks!

captDaylight commented 7 years ago

@tinybike How do you use this in your project?