Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .changeset/fix-adapter-type-declarations.md
Original file line number Diff line number Diff line change
@@ -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.
29 changes: 28 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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" ] || \
Expand Down
14 changes: 14 additions & 0 deletions adapters/cf/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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"
}
Expand Down
3 changes: 3 additions & 0 deletions adapters/cf/tsconfig.build.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"extends": "../tsconfig.adapter.json"
}
14 changes: 14 additions & 0 deletions adapters/pg/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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"
}
Expand Down
3 changes: 3 additions & 0 deletions adapters/pg/tsconfig.build.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"extends": "../tsconfig.adapter.json"
}
8 changes: 8 additions & 0 deletions adapters/tsconfig.adapter.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"extends": "../tsconfig.json",
"compilerOptions": {
"rootDir": "${configDir}/src",
"outDir": "${configDir}/dist"
},
"include": ["${configDir}/src/**/*.ts"]
}
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
Loading