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

Support '.graphqls' file extension #1382

Merged
merged 1 commit into from
Oct 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/nasty-rats-obey.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'houdini': patch
---

Support GraphQL files with \*.graphqls extension
6 changes: 5 additions & 1 deletion packages/houdini/src/lib/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1398,7 +1398,11 @@ async function loadSchemaFile(schemaPath: string): Promise<graphql.GraphQLSchema
const contents = (await fs.readFile(schemaPath))!

// if the schema points to an sdl file
if (schemaPath.endsWith('gql') || schemaPath.endsWith('graphql')) {
if (
schemaPath.endsWith('gql') ||
schemaPath.endsWith('graphql') ||
schemaPath.endsWith('graphqls')
) {
return graphql.buildSchema(contents)
}

Expand Down
6 changes: 5 additions & 1 deletion packages/houdini/src/lib/introspection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,11 @@ export async function pullSchema(

// Check if the schemapath ends with .gql or .graphql - if so write the schema as string
// Otherwise write the json/introspection
if (schemaPath!.endsWith('gql') || schemaPath!.endsWith('graphql')) {
if (
schemaPath!.endsWith('gql') ||
schemaPath!.endsWith('graphql') ||
schemaPath.endsWith('graphqls')
) {
const schema = graphql.buildClientSchema(jsonSchema)
fileData = graphql.printSchema(graphql.lexicographicSortSchema(schema))
} else {
Expand Down
Loading