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

Refactor GitLoader #1796

Merged
merged 1 commit into from Jul 18, 2020
Merged

Refactor GitLoader #1796

merged 1 commit into from Jul 18, 2020

Conversation

danielrearden
Copy link
Collaborator

The existing GitLoader's loadSync function is broken because it uses simple-git and simple-git does not provide a way to execute git commands synchronously -- its API either uses Promises or callbacks. This PR refactors the loader to utilize exec/execSync instead and adds tests.

@@ -34,11 +34,9 @@ export type GitLoaderOptions = SingleFileOptions & {
/**
* Additional options to pass to `graphql-tag-pluck`
*/
pluckConfig: GraphQLTagPluckOptions;
pluckConfig?: GraphQLTagPluckOptions;
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Making this optional since graphql-tag-pluck doesn't actually require an options object to be passed in.

}
}

function ensureSource({ rawSDL, pointer, path }: { rawSDL: string; pointer: string; path: string }) {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Dropping ensureSource and createInvalidExtensionError because gqlPluckFromCodeString guarantees a string is returned and will already throw if an extension is invalid.

@danielrearden danielrearden force-pushed the git-loader branch 6 times, most recently from 83f95dd to fb9b3d1 Compare July 18, 2020 03:18
@danielrearden danielrearden merged commit 479892b into ardatan:master Jul 18, 2020
@danielrearden danielrearden deleted the git-loader branch July 18, 2020 13:48
@theguild-bot
Copy link
Collaborator

The latest changes of this PR are available as alpha in npm: 6.0.15-alpha-479892bd.0

Quickly update your package.json by running:

npx match-version @graphql-tools 6.0.15-alpha-479892bd.0

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

Successfully merging this pull request may close these issues.

None yet

3 participants