Skip to content

Commit

Permalink
Drop graphql-tag (#12)
Browse files Browse the repository at this point in the history
Graphql-tag is tagged template which parses and normalizes queries
inside. In generated schema it means running parser in runtime.
Though why do we need to parse when we already have compiler to do all
the job.

Here I switched to "string" document mode to generate template literals
without any tags. So there is no more runtime overhead.

The only issue is duplicated fragments which break pinned posts query.
dedupeFragments helps to solve this by removing dependencies from
fragments and listing them all in queries.
  • Loading branch information
TrySound committed Jun 6, 2023
1 parent 1f362e5 commit 0b91234
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 25 deletions.
2 changes: 2 additions & 0 deletions codegen.yml
Expand Up @@ -10,6 +10,8 @@ generates:
preResolveTypes: true
onlyOperationTypes: true
enumsAsTypes: true
documentMode: "string"
dedupeFragments: true
plugins:
- typescript
- typescript-operations
Expand Down
1 change: 0 additions & 1 deletion package.json
Expand Up @@ -32,7 +32,6 @@
"code-tag": "^1.1.0",
"graphql": "^15.5.0",
"graphql-request": "^6.1.0",
"graphql-tag": "^2.11.0",
"gray-matter": "^4.0.2"
},
"devDependencies": {
Expand Down
54 changes: 30 additions & 24 deletions src/__generated__/index.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 0b91234

Please sign in to comment.