GraphQLSP icon indicating copy to clipboard operation
GraphQLSP copied to clipboard

Create directories recursively if they don't exist

Open GauBen opened this issue 5 months ago • 2 comments

Hey!

I'm generating the introspection types in a directory that is git-ignored, and graphqlsp does not create this directory automatically if not found

What do you think about adding something roughly like this?

if (output.endsWith('.ts')) {
  await mkdir(path.dirname(output), { recursive: true });
}

(with proper error handling of course)

Ref: https://github.com/0no-co/GraphQLSP/blob/acede9b019204fcd2dcb4e6ff1ba4b642eda80b7/packages/graphqlsp/src/graphql/getSchema.ts#L78-L87

I'd be happy to contribute a pull request if this change is accepted

GauBen avatar Sep 24 '24 09:09 GauBen