paulmillr / scure-btc-signer

Audited & minimal library for creating, signing & decoding Bitcoin transactions.
https://paulmillr.com/noble/#scure
MIT License
135 stars 33 forks source link

feat: use tsup for bundling #16

Closed aulneau closed 1 year ago

aulneau commented 1 year ago

This PR is just an example of how we can use tsup to take care of bundling. I personally love tsup and many projects make use of it. -> https://tsup.egoist.dev/

bundling takes less than 1 second on my machine:

CLI Building entry: index.ts
CLI Using tsconfig: tsconfig.json
CLI tsup v6.5.0
CLI Using tsup config: ./micro-btc-signer/tsup.config.ts
CLI Target: node16
CLI Cleaning output folder
CJS Build start
ESM Build start
DTS Build start
CJS dist/index.cjs 50.92 KB
CJS ⚡️ Build success in 210ms
ESM dist/index.js 47.46 KB
ESM ⚡️ Build success in 210ms
DTS ⚡️ Build success in 662ms
DTS dist/index.d.ts 60.88 KB

Process finished with exit code 0
paulmillr commented 1 year ago

I see it's faster. What are the other benefits? We are bringing at least 89 packages with it.

aulneau commented 1 year ago

yeah, true, there are dependencies of it we bring along. I'd say the benefits are you don't have to roll your own rollup/esbuild setup. there are also benefits around bundle size, minification, etc. you can recreate it by constructing a build step by hand, it all depends on the needs.

paulmillr commented 1 year ago

89 new deps is a no-go, since we're moving towards supply chain security