From 87da4cd71c1c4c57b031a841877a540cde5d7eef Mon Sep 17 00:00:00 2001 From: earthlingdavey <15802017+earthlingdavey@users.noreply.github.com> Date: Thu, 5 Mar 2026 17:44:23 +0000 Subject: [PATCH 1/2] fix: build kit-string before lint in CI --- .github/workflows/test.yml | 3 +++ PR.md | 38 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 41 insertions(+) create mode 100644 PR.md diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 2fb9b8a..8f656e3 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -22,6 +22,9 @@ jobs: - name: Check formatting run: deno fmt --check + - name: Build kit-string + run: deno task build:kit-string + - name: Lint run: deno lint diff --git a/PR.md b/PR.md new file mode 100644 index 0000000..1c68e48 --- /dev/null +++ b/PR.md @@ -0,0 +1,38 @@ +## Export kit driver as injectable string for drizzle-kit + +### Summary + +Adds a `./kit-string` export containing the bundled driver code as a string. This enables drizzle-kit to inject the `node:sqlite` driver without adding a runtime dependency. + +### Changes + +**API Refactoring** +- Move kit-only functions (`prepareSqliteParams`, `normaliseSQLiteUrl`) from `shared.ts` to `kit.ts` +- Simplify driver API: `createNodeSqlDriver(dbPath, prepareSqliteParams)` — caller provides the param preparation function + +**New Export** +- `./kit-string` exports `drizzleKitDriverBlock: string` containing the bundled driver code +- Generated via `deno task build:kit-string` using `Deno.bundle` +- Output goes to `dist/kit-string.ts` (gitignored, generated at publish time) + +**CI/Publishing** +- Added `build:kit-string` step to publish workflow +- Validates export statement is stripped (fails fast if bundler output format changes) + +**Improved Error Handling** +- Add `hasColumns()` guard in proxy fallback path with descriptive error message +- Consistent error handling between shared and kit code paths + +### Usage in drizzle-kit + +```ts +import { drizzleKitDriverBlock } from "@hotsauce/drizzle-runtime-sqlite/kit-string"; + +// Inject into connections.ts at build time +const nodeSqliteDriver = new Function(drizzleKitDriverBlock + "; return createNodeSqlDriver;")(); +``` + +### Testing + +- All 133 tests pass (Deno 2.7) +- Build script validated From 175af61fffb40eb14af33a4aff4768aae058e5a5 Mon Sep 17 00:00:00 2001 From: earthlingdavey <15802017+earthlingdavey@users.noreply.github.com> Date: Thu, 5 Mar 2026 18:33:54 +0000 Subject: [PATCH 2/2] fix: include dist/kit-string.ts in publish --- deno.jsonc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/deno.jsonc b/deno.jsonc index fec0d47..dc2845c 100644 --- a/deno.jsonc +++ b/deno.jsonc @@ -35,5 +35,8 @@ "strict": true, "noImplicitAny": true }, + "publish": { + "exclude": ["!dist/kit-string.ts"] + }, "nodeModulesDir": "auto" }