chore: build all packages with tsup, ship ESM + CJS and typedefs#17
Open
eduardoborges wants to merge 2 commits intoAbacatePay:mainfrom
Open
chore: build all packages with tsup, ship ESM + CJS and typedefs#17eduardoborges wants to merge 2 commits intoAbacatePay:mainfrom
eduardoborges wants to merge 2 commits intoAbacatePay:mainfrom
Conversation
- Add tsup.config.ts with entry points for index, v1, v2 - Replace bun build + tsc with single tsup build (ESM + dts) - Add typings field to package.json for declaration discovery - Add tsup devDependency Made-with: Cursor
- Add tsup to every package (rest, types, zod, typebox, adapters, supabase, hono, fastify, express, elysia, better-auth, eslint-plugin, sdk) - Single build step: ESM, CJS, and .d.ts via tsup (dts: true) - Add typings field and require exports for CJS consumers - types: add v1/routes and v2/routes entries for SDK subpath imports - sdk tsconfig: drop empty paths override so base paths apply for dts Made-with: Cursor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Packages were built with a mix of
bun build+tsc --emitDeclarationOnly, ortscalone. That led to:rootDir/path resolution.require()or older Node/bundlers had no supported CJS entry.rm -rf dist,bun run types), making the monorepo harder to maintain.Motivation
import(ESM) andrequire(CJS) viapackage.jsonexportsandmainso Node, bundlers, and legacy setups can consume the packages.types/typingsand correctexportsso TypeScript and editors resolve declarations without extra config.Changes
tsup.config.tswithformat: ["esm", "cjs"]anddts: true.bun run scripts/version.ts && tsup(orgen:versionwhere used); the separatetypesscript was removed.exports:import→.js,require→.cjs,types→.d.ts(and subpaths where applicable).mainset to.cjsfor CJS entry.typingsadded alongsidetypes.tsupadded as a devDependency.types/v1/routes.tsandtypes/v2/routes.tsadded as tsup entries so@abacatepay/types/v1/routesresolves for the SDK.tsconfig.jsonno longer overridespathswith{}, so the base config paths are used for declaration generation.