From 478a08e23fe726266c044d331ca8c6042008404d Mon Sep 17 00:00:00 2001 From: Steven Linn Date: Fri, 3 Apr 2026 23:31:04 -0600 Subject: [PATCH 1/4] fix: emit type declarations for pg and cf adapters --- adapters/cf/tsconfig.build.json | 8 ++++++++ adapters/pg/tsconfig.build.json | 8 ++++++++ package.json | 6 +++--- 3 files changed, 19 insertions(+), 3 deletions(-) create mode 100644 adapters/cf/tsconfig.build.json create mode 100644 adapters/pg/tsconfig.build.json diff --git a/adapters/cf/tsconfig.build.json b/adapters/cf/tsconfig.build.json new file mode 100644 index 0000000..d9721d3 --- /dev/null +++ b/adapters/cf/tsconfig.build.json @@ -0,0 +1,8 @@ +{ + "extends": "../../tsconfig.json", + "compilerOptions": { + "rootDir": "./src", + "outDir": "./dist" + }, + "include": ["./src/**/*.ts"] +} diff --git a/adapters/pg/tsconfig.build.json b/adapters/pg/tsconfig.build.json new file mode 100644 index 0000000..d9721d3 --- /dev/null +++ b/adapters/pg/tsconfig.build.json @@ -0,0 +1,8 @@ +{ + "extends": "../../tsconfig.json", + "compilerOptions": { + "rootDir": "./src", + "outDir": "./dist" + }, + "include": ["./src/**/*.ts"] +} diff --git a/package.json b/package.json index 626e4df..42fcf19 100644 --- a/package.json +++ b/package.json @@ -25,11 +25,11 @@ "build": "pnpm copyfiles && pnpm build:types && pnpm build:swc && pnpm build:adapters", "build:swc": "swc ./src -d ./dist --config-file .swcrc --strip-leading-paths", "build:adapters": "pnpm build:adapters:pg && pnpm build:adapters:cf", - "build:adapters:pg": "cd ./adapters/pg && swc ./src -d ./dist --config-file ../../.swcrc --strip-leading-paths", - "build:adapters:cf": "cd ./adapters/cf && swc ./src -d ./dist --config-file ../../.swcrc --strip-leading-paths", + "build:adapters:pg": "cd ./adapters/pg && tsc -p tsconfig.build.json && swc ./src -d ./dist --config-file ../../.swcrc --strip-leading-paths", + "build:adapters:cf": "cd ./adapters/cf && tsc -p tsconfig.build.json && swc ./src -d ./dist --config-file ../../.swcrc --strip-leading-paths", "build:types": "tsc -p tsconfig.build.json --outDir dist --rootDir ./src", "build:types:all": "pnpm build:types && tsc --noEmit", - "clean": "rimraf {dist,*.tsbuildinfo,adapters/pg/dist,adapters/cf/dist}", + "clean": "rimraf {dist,*.tsbuildinfo,adapters/*/dist,adapters/*/*.tsbuildinfo}", "copyfiles": "copyfiles -u 1 \"src/**/*.{html,css,scss,ttf,woff,woff2,eot,svg,jpg,png,json}\" dist/", "dev": "cross-env DOTENV_CONFIG_PATH=dev/.env.development NODE_OPTIONS=--require=dotenv/config next dev dev --turbo", "dev:generate-importmap": "pnpm dev:payload generate:importmap", From 3499d71938638105a4e93fc09685072c2fac40da Mon Sep 17 00:00:00 2001 From: Steven Linn Date: Fri, 3 Apr 2026 23:48:15 -0600 Subject: [PATCH 2/4] Add exports field to pg and cf adapter package.json files --- adapters/cf/package.json | 14 ++++++++++++++ adapters/pg/package.json | 14 ++++++++++++++ 2 files changed, 28 insertions(+) diff --git a/adapters/cf/package.json b/adapters/cf/package.json index b492188..8031caa 100644 --- a/adapters/cf/package.json +++ b/adapters/cf/package.json @@ -9,6 +9,13 @@ ], "main": "./dist/index.js", "types": "./dist/index.d.ts", + "exports": { + ".": { + "types": "./dist/index.d.ts", + "import": "./dist/index.js", + "default": "./dist/index.js" + } + }, "peerDependencies": { "payload": ">=3.0.0 <4.0.0", "payloadcms-vectorize": ">=0.7.0" @@ -21,6 +28,13 @@ "pnpm": "^9 || ^10" }, "publishConfig": { + "exports": { + ".": { + "types": "./dist/index.d.ts", + "import": "./dist/index.js", + "default": "./dist/index.js" + } + }, "main": "./dist/index.js", "types": "./dist/index.d.ts" } diff --git a/adapters/pg/package.json b/adapters/pg/package.json index 62aefbb..7e6c27a 100644 --- a/adapters/pg/package.json +++ b/adapters/pg/package.json @@ -9,6 +9,13 @@ ], "main": "./dist/index.js", "types": "./dist/index.d.ts", + "exports": { + ".": { + "types": "./dist/index.d.ts", + "import": "./dist/index.js", + "default": "./dist/index.js" + } + }, "peerDependencies": { "payload": ">=3.0.0 <4.0.0", "payloadcms-vectorize": ">=0.7.0", @@ -26,6 +33,13 @@ "pnpm": "^9 || ^10" }, "publishConfig": { + "exports": { + ".": { + "types": "./dist/index.d.ts", + "import": "./dist/index.js", + "default": "./dist/index.js" + } + }, "main": "./dist/index.js", "types": "./dist/index.d.ts" } From d0d52c5787fd6bcade3046fdc45c9dab5031628f Mon Sep 17 00:00:00 2001 From: techiejd <62455039+techiejd@users.noreply.github.com> Date: Tue, 21 Apr 2026 07:57:19 +0700 Subject: [PATCH 3/4] refactor: share tsconfig base across adapters Introduce adapters/tsconfig.adapter.json as a single shared build config and have each adapter's tsconfig.build.json extend it. Uses ${configDir} (TS 5.5+) so rootDir/outDir/include resolve relative to the extending adapter without per-adapter duplication. --- adapters/cf/tsconfig.build.json | 7 +------ adapters/pg/tsconfig.build.json | 7 +------ adapters/tsconfig.adapter.json | 8 ++++++++ 3 files changed, 10 insertions(+), 12 deletions(-) create mode 100644 adapters/tsconfig.adapter.json diff --git a/adapters/cf/tsconfig.build.json b/adapters/cf/tsconfig.build.json index d9721d3..3a56da8 100644 --- a/adapters/cf/tsconfig.build.json +++ b/adapters/cf/tsconfig.build.json @@ -1,8 +1,3 @@ { - "extends": "../../tsconfig.json", - "compilerOptions": { - "rootDir": "./src", - "outDir": "./dist" - }, - "include": ["./src/**/*.ts"] + "extends": "../tsconfig.adapter.json" } diff --git a/adapters/pg/tsconfig.build.json b/adapters/pg/tsconfig.build.json index d9721d3..3a56da8 100644 --- a/adapters/pg/tsconfig.build.json +++ b/adapters/pg/tsconfig.build.json @@ -1,8 +1,3 @@ { - "extends": "../../tsconfig.json", - "compilerOptions": { - "rootDir": "./src", - "outDir": "./dist" - }, - "include": ["./src/**/*.ts"] + "extends": "../tsconfig.adapter.json" } diff --git a/adapters/tsconfig.adapter.json b/adapters/tsconfig.adapter.json new file mode 100644 index 0000000..c03cbd5 --- /dev/null +++ b/adapters/tsconfig.adapter.json @@ -0,0 +1,8 @@ +{ + "extends": "../tsconfig.json", + "compilerOptions": { + "rootDir": "${configDir}/src", + "outDir": "${configDir}/dist" + }, + "include": ["${configDir}/src/**/*.ts"] +} From 9585c149b02b2c56154b50b3c33f5d69669f75f5 Mon Sep 17 00:00:00 2001 From: techiejd <62455039+techiejd@users.noreply.github.com> Date: Tue, 21 Apr 2026 07:58:41 +0700 Subject: [PATCH 4/4] ci+changeset: verify adapter type declarations and record fix - CI: add a `build` job that runs `pnpm build` and asserts dist/index.d.ts exists for the main package and both adapters, so a future SWC-only regression is caught before publish. Gate it in the aggregate `test` job. - Changeset: add patch bumps for @payloadcms-vectorize/pg and @payloadcms-vectorize/cf so root and adapter CHANGELOGs are generated automatically on `pnpm changeset:version`. --- .changeset/fix-adapter-type-declarations.md | 6 +++++ .github/workflows/ci.yml | 29 ++++++++++++++++++++- 2 files changed, 34 insertions(+), 1 deletion(-) create mode 100644 .changeset/fix-adapter-type-declarations.md diff --git a/.changeset/fix-adapter-type-declarations.md b/.changeset/fix-adapter-type-declarations.md new file mode 100644 index 0000000..e02ec6d --- /dev/null +++ b/.changeset/fix-adapter-type-declarations.md @@ -0,0 +1,6 @@ +--- +"@payloadcms-vectorize/pg": patch +"@payloadcms-vectorize/cf": patch +--- + +Fix missing TypeScript declarations in `@payloadcms-vectorize/pg` and `@payloadcms-vectorize/cf`. The build now runs `tsc` before SWC so `dist/index.d.ts` is actually emitted, and both adapters expose modern conditional `exports` with a types-first condition. diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 84532f8..7057f71 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -206,14 +206,41 @@ jobs: IVFFLATLISTS: 1 TEST_ENV: 1 + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Install pnpm + uses: pnpm/action-setup@v4 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: '20' + cache: 'pnpm' + + - name: Install dependencies + run: pnpm install + + - name: Build all packages + run: pnpm build + + - name: Verify type declarations emitted + run: | + test -f dist/index.d.ts + test -f adapters/pg/dist/index.d.ts + test -f adapters/cf/dist/index.d.ts + test: runs-on: ubuntu-latest - needs: [typecheck, test_int, test_adapters_pg, test_adapters_cf, test_e2e] + needs: [typecheck, build, test_int, test_adapters_pg, test_adapters_cf, test_e2e] if: always() steps: - name: Check required jobs run: | if [ "${{ needs.typecheck.result }}" != "success" ] || \ + [ "${{ needs.build.result }}" != "success" ] || \ [ "${{ needs.test_int.result }}" != "success" ] || \ [ "${{ needs.test_adapters_pg.result }}" != "success" ] || \ [ "${{ needs.test_adapters_cf.result }}" != "success" ] || \