penumbra-zone / web

Apache License 2.0
10 stars 7 forks source link

publish useful packages #1305

Closed turbocrime closed 1 week ago

turbocrime commented 1 week ago

use tsc for package builds, instead of vite lib mode.

build is much faster.

all remaining packages are correctly dependent, minimally chunked/bundled/polyfilled for target, and should be usable outside the repository.

changeset-bot[bot] commented 1 week ago

🦋 Changeset detected

Latest commit: 656db1c9721ce1d7dbdce5b0fa7352e037415cfc

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 20 packages | Name | Type | | ------------------------------- | ----- | | @penumbra-zone/transport-chrome | Major | | @repo/tailwind-config | Major | | @repo/eslint-config | Major | | @penumbra-zone/transport-dom | Major | | @penumbra-zone/perspective | Major | | @penumbra-zone/protobuf | Major | | @penumbra-zone/services | Major | | @repo/tsconfig | Major | | node-status | Major | | @penumbra-zone/bech32m | Major | | @penumbra-zone/getters | Major | | @penumbra-zone/storage | Major | | @penumbra-zone/client | Major | | @penumbra-zone/crypto-web | Major | | @penumbra-zone/zquery | Major | | minifront | Major | | @penumbra-zone/query | Major | | @penumbra-zone/types | Major | | @penumbra-zone/wasm | Major | | @repo/ui | Major |

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

TalDerei commented 1 week ago

high-level question, what's generally the difference between building with turbo versus tsup?

turbocrime commented 1 week ago

turbo is the task runner.

the change is away from vite build lib mode.

vite is primarily a website bundler and required a lot of configuration to build packages for publishing/consumption. lib mode is definitely an afterthought, and the plugins we needed to achieve things simply like external deps or typescript output were not well maintained - config didnt merge well, there were quirks to work around, etc

tsup was something we looked at initially but was decided against. @VanishMax demonstrated a pretty concise use of it that seemed much nicer than our vite build configs.

so this publishes the remainder of the packages that we should publish, applies package config that solves issues experienced by consumers, and uses tsup for all package builds, except wasm. wasm might be done with a bit more effort.

turbocrime commented 1 week ago

tsc was also used directly for some builds, but there are internal deps like polyfills that we do want to inline.

vite and tsup both use esbuild and rollup internally.

turbocrime commented 1 week ago

this also avoids api-extractor which is very slow. api-extractor has benefits and features over rollup but we don't use them, and it lags behind typescript releases. we can enable it with a tsup flag if we choose.

VanishMax commented 1 week ago

@turbocrime It is great to see how you took over the packages build configuration and perfected the use of tsup. Awesome changes!

turbocrime commented 1 week ago

before merging, can we ensure that peer deps and tsup config are in-fact working? There were some issues last night that I'm not sure were resolved

tsup was not in fact working. turns out it mangles types due to some underlying esbuild issue, and that was what was causing peer issues and prevented services init.

i ended up removing tsup. all package builds now use bare tsc.