Skip to content

fix: emit type declarations for pg and cf adapters#46

Merged
techiejd merged 4 commits intotechiejd:mainfrom
stevenlafl:fix/adapter-type-declarations
Apr 21, 2026
Merged

fix: emit type declarations for pg and cf adapters#46
techiejd merged 4 commits intotechiejd:mainfrom
stevenlafl:fix/adapter-type-declarations

Conversation

@stevenlafl
Copy link
Copy Markdown
Contributor

The adapter build scripts (build:adapters:pg, build:adapters:cf) only ran SWC, which does not emit .d.ts files. Both adapter packages declare "types": "./dist/index.d.ts" in package.json, but the file was never generated — breaking TypeScript consumers.

Changes:

  • Add tsconfig.build.json for each adapter (extends root tsconfig, scoped to adapter src/)
  • Add tsc -p tsconfig.build.json to each adapter build script (types first, then SWC — matching the main package pattern)
  • Add adapters/*/*.tsbuildinfo to the clean script so incremental builds don't skip declaration emit

@stevenlafl stevenlafl requested a review from techiejd as a code owner April 4, 2026 05:32
Copilot AI review requested due to automatic review settings April 4, 2026 05:32
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes TypeScript consumer breakage for the @payloadcms-vectorize/pg and @payloadcms-vectorize/cf adapter packages by ensuring their declared dist/index.d.ts files are actually generated during builds.

Changes:

  • Update adapter build scripts to run tsc (declaration emit) before SWC transpilation.
  • Add adapter-scoped tsconfig.build.json files to emit declarations into each adapter’s dist/.
  • Expand clean to remove adapter dist/ folders and adapter-level *.tsbuildinfo files.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
package.json Runs tsc -p for each adapter before SWC and cleans adapter tsbuildinfo artifacts.
adapters/pg/tsconfig.build.json Adds an adapter-scoped TS build config to emit declarations into adapters/pg/dist.
adapters/cf/tsconfig.build.json Adds an adapter-scoped TS build config to emit declarations into adapters/cf/dist.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@rob-at-cortex
Copy link
Copy Markdown

is this package still maintained ?

@techiejd
Copy link
Copy Markdown
Owner

Hi stevenlafl!

Sorry about this. I'm not sure how I missed it. Thank you for your contribution.

I'm taking a look.

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.
- 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`.
@techiejd techiejd merged commit 664b2b6 into techiejd:main Apr 21, 2026
12 of 14 checks passed
@techiejd
Copy link
Copy Markdown
Owner

Great job! I'll update here when it's been published.

Again, I'm so sorry about how long I took. I even noticed when you forked and am not sure how I missed the PR.

@github-actions github-actions Bot mentioned this pull request Apr 21, 2026
@stevenlafl stevenlafl deleted the fix/adapter-type-declarations branch April 21, 2026 05:36
@stevenlafl
Copy link
Copy Markdown
Contributor Author

stevenlafl commented Apr 21, 2026

It's not your fault, don't worry. I used npm patches for production, didn't need to wait for it. That's my workflow. If you didn't know about that feature, it's amazing. (been doing this a long time and just found out a month ago)

@github-actions github-actions Bot mentioned this pull request Apr 21, 2026
@techiejd
Copy link
Copy Markdown
Owner

I'm glad you weren't blocked by this and were able to use patch as a stopgap.

I missed the email where you added the PR. I've created a filter that marks notifications@github.com as 'important'.
So hopefully this won't happen again.

Thank you very much for your patience and for following up on it.

Your changes are now published! (0.7.2)

Thank you for your contribution~

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants