Skip to content

Conversation

@bendrucker
Copy link
Collaborator

@bendrucker bendrucker commented Jul 10, 2025

Adds a npm run generate script that in a single command will generate builtins.js.

Previously, the SQL query to fetch the data was documented in the file and the data was translated to JavaScript manually. As well as to TypeScript, in index.d.ts. This meant these 3 could get out of sync, as in #161, where the initial post just updated the JS, a commenter noted the SQL change, and I only now realized the type definition was missing. Now, executing the query and translating the results to JS and TS is fully automated.

For future extension, it supports multiple PostgreSQL versions. Through trial and error I found the current builtins.js content reflects v11. But this version is no longer supported, so we should increase the minimum Postgres version in a future major version.

Additionally, a generate job in CI runs the process and verifies no diff to ensure all is in sync. If there is a diff, the generator needs to be re-run.

@bendrucker bendrucker merged commit 27b22f4 into master Jul 30, 2025
8 checks passed
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.

2 participants