Skip to content

Commit

Permalink
Fix GraphQLScalarType always being imported when post-processing file…
Browse files Browse the repository at this point in the history
…s, even if it's not used (#290)

* Convert generalResolver -> specific resolver types

* Implement logic to avoid importing GraphQLScalarType when postProcessing if the default variable statement is not added

* Set up e2e test

* Add changeset

* Fix unit test
  • Loading branch information
eddeee888 authored Jun 8, 2024
1 parent 7367d8d commit 86babc6
Show file tree
Hide file tree
Showing 14 changed files with 405 additions and 303 deletions.
5 changes: 5 additions & 0 deletions .changeset/shaggy-geese-matter.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@eddeee888/gcg-typescript-resolver-files': patch
---

Fix issue where GraphQLScalarType is imported all the time, regardless of whether it's used
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,4 @@ type PaginationResult {

scalar DateTime
scalar SomeRandomScalar
scalar CustomLogicScalar
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import { DateResolver } from 'graphql-scalars';
DateResolver.description = undefined;
export const CustomLogicScalar = DateResolver;
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { Profile } from './zoo/resolvers/Profile';
import { Topic } from './topic/resolvers/Topic';
import { TopicCreateResult } from './topic/resolvers/TopicCreateResult';
import { User } from './pet/resolvers/User';
import { CustomLogicScalar } from './base/resolvers/CustomLogicScalar';
import { SomeRandomScalar } from './base/resolvers/SomeRandomScalar';
import { Error } from './base/resolvers/Error';
import { TopicCreatePayload } from './topic/resolvers/TopicCreatePayload';
Expand All @@ -26,6 +27,7 @@ export const resolvers: Resolvers = {
Topic: Topic,
TopicCreateResult: TopicCreateResult,
User: User,
CustomLogicScalar: CustomLogicScalar,
SomeRandomScalar: SomeRandomScalar,
Error: Error,
TopicCreatePayload: TopicCreatePayload,
Expand Down
Loading

0 comments on commit 86babc6

Please sign in to comment.