Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Search through untracked files for graphql-tag. Don't error out on files that can't be found. #66

Merged
merged 2 commits into from
Jul 2, 2024

Conversation

jeresig
Copy link
Member

@jeresig jeresig commented Jul 2, 2024

Summary:

This fixes two bugs:

  1. Creating types wouldn't work if the files hadn't yet been checked in to Git. This fixes that by now searching through untracked files, as well.
  2. The script couldn't run if the graphql type files didn't exist. This fixes that by gracefully handling paths that don't exist.

Issue: FEI-5065

Test plan:

I built it and ran it in webapp and it worked as expected.

@jeresig jeresig self-assigned this Jul 2, 2024
@jeresig jeresig requested review from kevinb-khan and a team July 2, 2024 15:35
Copy link

changeset-bot bot commented Jul 2, 2024

🦋 Changeset detected

Latest commit: 0c46a05

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@khanacademy/graphql-flow Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@jeresig jeresig requested a review from jaredly July 2, 2024 15:35
Copy link
Member

@somewhatabstract somewhatabstract left a comment

Choose a reason for hiding this comment

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

Looks good to me. I would love it if you could add a touch more commentary, but it's no big deal. Thanks for fixing these things.


My review uses Conventional Comments to add context and set expectations for the comments I am leaving.

Comment on lines +35 to +37
// NOTE(john): We want to include untracked files here so that we can
// generate types for them. This is useful for when we have a new file
// that we want to generate types for, but we haven't committed it yet.
Copy link
Member

Choose a reason for hiding this comment

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

praise: Thanks for the comment.

Comment on lines 23 to 25
// NOTE(john): This is a bit of a hack, but it's necessary for when we
// have a file that doesn't have an extension. This will happen when we
// delete all of the type files before re-running graphql-flow again.
Copy link
Member

Choose a reason for hiding this comment

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

question: What is the side-effect of doing this? Can you elaborate in the comment on why this will "just work"? Or perhaps add a comment in the parse.ts code that explains what an empty string means?

@jeresig jeresig merged commit c6be76f into main Jul 2, 2024
1 check passed
@jeresig jeresig deleted the FEI-5065 branch July 2, 2024 16:16
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