Skip to content

Commit

Permalink
Support '.graphqls' file extension
Browse files Browse the repository at this point in the history
  • Loading branch information
gschulze committed Oct 29, 2024
1 parent fa869ce commit d8097aa
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
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

0 comments on commit d8097aa

Please sign in to comment.