0no-co / gql.tada

🪄 Magical GraphQL query engine for TypeScript
https://gql-tada.0no.co
MIT License
2.52k stars 41 forks source link

The new `generate persisted` command breaks when the hash argument is not double quoted #211

Closed dnlsandiego closed 4 months ago

dnlsandiego commented 4 months ago

Describe the bug

Hey folks, Really great release today! Super excited on utilizing persisted operations to migrate off of graphql-codegen.

I just tried out the new CLI command gql.tada generate persisted -o persisted.json but I was getting this error:

Could not generate persisted manifest file
┗ Unexpected token ''', "'sha256:x'" is not valid JSON

The file I was trying out was straight out of the dev blog:

import { graphql } from 'gql.tada'

const query = graphql(`
  query Hello {
    hello
  }
`)

const persistedOperation = graphql.persisted<typeof query>('sha256:x')

Changing 'sha256:x' to "sha256:x" seems to have fixed the issue. But other than this the new persisted command works great.

Reproduction

No response

gql.tada version

gql.tada 1.5.0 @0no-co/graphqlsp 1.10.1

Validations