libsql-client-ts
libsql-client-ts copied to clipboard
Fix CJS imports for `@libsql/client`
Addresses #182.
This PR aims to fix CJS imports, something that may be blocking the Drizzle Team from merging https://github.com/drizzle-team/drizzle-orm/pull/4998 due to our CJS import test for drizzle-orm/libsql. We assume this issue is caused by what is described in #182 which is using the same typings for both ESM and CJS.
ATTW was used to verify the new build outputs work in both ESM and CJS.
libsql-core subpackage:
Current
npm run build && npm pack && attw ./[generated package file].tgz
In this PR
npm ru build && cd dist && npm pack --pack-destination .. && cd .. && attw ./[generated package file].tgz
libsql-client subpackage:
In this PR
Changes made
- Introduce
tsupto properly generate .cjs and .d.cts files. - Remove unusued imports in
libsql-core/src/util.ts. - Update publish workflow according to the new output produced by tsup.
- Remove what seems to be unused prebuild and postbuild scripts in
libsql-coreandlibsql-client. - Remove files that are no longer relevant with to tsup (like
tsconfig.build-cjs.json). - Update
@libsql/coreinlibsql-client. Had to update as there was a type introduced in 0.16.0 and the build wasn't going to work if I kept@libsql/coreon 0.15.x.
@penberg Hi there. Let me know if there's anything that needs to be done with this PR for it to be merged. Would greatly appreciate it!