Skip to content

Commit b4d653e

Browse files
authored
Use Guild's GraphQL Toolkit (#77)
* Use Guild's GraphQL Toolkit * Pass --token to cli introspection * Normalize remote schema * Describe changes
1 parent dbc0e41 commit b4d653e

File tree

20 files changed

+874
-1051
lines changed

20 files changed

+874
-1051
lines changed

β€ŽCHANGELOG.mdβ€Ž

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33
### vNEXT
44

5+
- **load**: use The Guild's `graphql-toolkit` [PR #77](https://github.com/kamilkisiela/graphql-inspector/pull/77)
6+
- **cli**: pass `--token` to introspection [PR #77](https://github.com/kamilkisiela/graphql-inspector/pull/77)
7+
- **cli**: pass `--token` to introspection command [PR #77](https://github.com/kamilkisiela/graphql-inspector/pull/77)
8+
59
### v0.12.0
610

711
- Move `graphql` to peer dependencies [PR #70](https://github.com/kamilkisiela/graphql-inspector/pull/70)

β€Žpackage.jsonβ€Ž

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,6 @@
6161
]
6262
},
6363
"resoultions": {
64-
"@types/react": "16.7.13",
65-
"@types/react-dom": "16.0.11",
6664
"babel-loader": "8.0.4"
6765
}
6866
}

β€Žpackages/cli/__tests__/diff.tsβ€Ž

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1+
import {resolve} from 'path';
12
import {diff} from '../src/commands/diff';
23
import {ConsoleRenderer} from '../src/render';
34

4-
const oldSchema = './assets/old.graphql';
5-
const newSchema = './assets/new.graphql';
5+
const oldSchema = resolve(__dirname, './assets/old.graphql');
6+
const newSchema = resolve(__dirname, './assets/new.graphql');
67

78
function hasMessage(msg: string) {
89
return (args: string[]) => args.join('').indexOf(msg) !== -1;

β€Žpackages/cli/src/commands/introspect.tsβ€Ž

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import {introspectionFromSchema, printSchema} from 'graphql';
88
export async function introspect(
99
schemaPointer: string,
1010
options: {
11+
token?: string;
1112
write?: string;
1213
require: string[];
1314
renderer?: Renderer;
@@ -17,7 +18,9 @@ export async function introspect(
1718
const renderer = options.renderer || new ConsoleRenderer();
1819

1920
try {
20-
const schema = await loadSchema(schemaPointer);
21+
const schema = await loadSchema(schemaPointer, {
22+
token: options.token,
23+
});
2124
const introspection = introspectionFromSchema(schema);
2225
const filepath = resolve(process.cwd(), output);
2326
let content: string;

β€Žpackages/load/package.jsonβ€Ž

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,16 +30,12 @@
3030
"graphql": "^0.13.0 || ^14.0.0"
3131
},
3232
"dependencies": {
33-
"glob": "7.1.3",
34-
"graphql-tag-pluck": "0.4.4",
35-
"is-glob": "4.0.0",
36-
"is-valid-path": "0.1.1",
33+
"graphql-toolkit": "0.0.3",
3734
"node-fetch": "2.3.0"
3835
},
3936
"devDependencies": {
4037
"@types/express": "4.16.0",
4138
"@types/glob": "7.1.1",
42-
"@types/is-glob": "4.0.0",
4339
"@types/jest": "23.3.10",
4440
"@types/node": "10.12.12",
4541
"@types/node-fetch": "2.1.4",
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import {Source, print} from 'graphql';
2+
import {loadDocuments as useDocuments} from 'graphql-toolkit';
3+
4+
export async function loadDocuments(pointer: string): Promise<Source[]> {
5+
const documents = await useDocuments(pointer);
6+
7+
return documents.map(doc => new Source(print(doc.content), doc.filePath));
8+
}

β€Žpackages/load/src/documents/from-glob-files.tsβ€Ž

Lines changed: 0 additions & 79 deletions
This file was deleted.

β€Žpackages/load/src/documents/index.tsβ€Ž

Lines changed: 0 additions & 31 deletions
This file was deleted.

β€Žpackages/load/src/documents/loader.tsβ€Ž

Lines changed: 0 additions & 4 deletions
This file was deleted.

β€Žpackages/load/src/helpers/path.tsβ€Ž

Lines changed: 0 additions & 8 deletions
This file was deleted.

0 commit comments

Comments
Β (0)