Skip to content

Update graphql codegen setup#73

Merged
bluwy merged 2 commits into
mainfrom
update-graphql-codegen
May 29, 2026
Merged

Update graphql codegen setup#73
bluwy merged 2 commits into
mainfrom
update-graphql-codegen

Conversation

@bluwy
Copy link
Copy Markdown
Member

@bluwy bluwy commented May 29, 2026

Update its dependencies and its new setup (handling its breaking changes)

@socket-security
Copy link
Copy Markdown

socket-security Bot commented May 29, 2026

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Added@​graphql-codegen/​cli@​7.0.0951007798100

View full report

Comment thread src/github/codegen.ts
Comment on lines +4 to +16
const schemaPath = "node_modules/.cache/github-graphql-schema.graphql";

if (process.env.CI || !fs.existsSync(schemaPath)) {
const result = await fetch(
"https://docs.github.com/public/fpt/schema.docs.graphql",
);
if (!result.ok) {
throw new Error(
`Failed to fetch GitHub GraphQL schema: ${result.status} ${result.statusText}`,
);
}
fs.writeFileSync(schemaPath, await result.text());
}
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I added this code instead of using @octokit/graphql-schema because the package had outdated schema for a while now (due to npm token changes), so this will allow us to work with more up-to-date APIs.

I implemented caching here so that we don't always fetch the schema everytime we run codegen.

Comment thread src/github/codegen.ts
Comment on lines +25 to +26
// TODO: Look into adding stricter types or use `unknown`
defaultScalarType: "any",
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

This is mainly for compat with the previous codegen to prevent type errors, as it'd default to unknown. We should look into this later.

@bluwy bluwy added this pull request to the merge queue May 29, 2026
Merged via the queue into main with commit aefdd95 May 29, 2026
9 checks passed
@bluwy bluwy deleted the update-graphql-codegen branch May 29, 2026 11:13
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