builtins: generate in 1 command #164
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Adds a
npm run generatescript that in a single command will generatebuiltins.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.jscontent reflects v11. But this version is no longer supported, so we should increase the minimum Postgres version in a future major version.Additionally, a
generatejob 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.