Skip to content

Commit

Permalink
Use Guild's GraphQL Toolkit (#77)
Browse files Browse the repository at this point in the history
* Use Guild's GraphQL Toolkit

* Pass --token to cli introspection

* Normalize remote schema

* Describe changes
  • Loading branch information
kamilkisiela authored Jan 30, 2019
1 parent dbc0e41 commit b4d653e
Show file tree
Hide file tree
Showing 20 changed files with 874 additions and 1,051 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

### vNEXT

- **load**: use The Guild's `graphql-toolkit` [PR #77](https://github.com/kamilkisiela/graphql-inspector/pull/77)
- **cli**: pass `--token` to introspection [PR #77](https://github.com/kamilkisiela/graphql-inspector/pull/77)
- **cli**: pass `--token` to introspection command [PR #77](https://github.com/kamilkisiela/graphql-inspector/pull/77)

### v0.12.0

- Move `graphql` to peer dependencies [PR #70](https://github.com/kamilkisiela/graphql-inspector/pull/70)
Expand Down
2 changes: 0 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,6 @@
]
},
"resoultions": {
"@types/react": "16.7.13",
"@types/react-dom": "16.0.11",
"babel-loader": "8.0.4"
}
}
5 changes: 3 additions & 2 deletions packages/cli/__tests__/diff.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import {resolve} from 'path';
import {diff} from '../src/commands/diff';
import {ConsoleRenderer} from '../src/render';

const oldSchema = './assets/old.graphql';
const newSchema = './assets/new.graphql';
const oldSchema = resolve(__dirname, './assets/old.graphql');
const newSchema = resolve(__dirname, './assets/new.graphql');

function hasMessage(msg: string) {
return (args: string[]) => args.join('').indexOf(msg) !== -1;
Expand Down
5 changes: 4 additions & 1 deletion packages/cli/src/commands/introspect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {introspectionFromSchema, printSchema} from 'graphql';
export async function introspect(
schemaPointer: string,
options: {
token?: string;
write?: string;
require: string[];
renderer?: Renderer;
Expand All @@ -17,7 +18,9 @@ export async function introspect(
const renderer = options.renderer || new ConsoleRenderer();

try {
const schema = await loadSchema(schemaPointer);
const schema = await loadSchema(schemaPointer, {
token: options.token,
});
const introspection = introspectionFromSchema(schema);
const filepath = resolve(process.cwd(), output);
let content: string;
Expand Down
6 changes: 1 addition & 5 deletions packages/load/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,16 +30,12 @@
"graphql": "^0.13.0 || ^14.0.0"
},
"dependencies": {
"glob": "7.1.3",
"graphql-tag-pluck": "0.4.4",
"is-glob": "4.0.0",
"is-valid-path": "0.1.1",
"graphql-toolkit": "0.0.3",
"node-fetch": "2.3.0"
},
"devDependencies": {
"@types/express": "4.16.0",
"@types/glob": "7.1.1",
"@types/is-glob": "4.0.0",
"@types/jest": "23.3.10",
"@types/node": "10.12.12",
"@types/node-fetch": "2.1.4",
Expand Down
8 changes: 8 additions & 0 deletions packages/load/src/documents.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import {Source, print} from 'graphql';
import {loadDocuments as useDocuments} from 'graphql-toolkit';

export async function loadDocuments(pointer: string): Promise<Source[]> {
const documents = await useDocuments(pointer);

return documents.map(doc => new Source(print(doc.content), doc.filePath));
}
79 changes: 0 additions & 79 deletions packages/load/src/documents/from-glob-files.ts

This file was deleted.

31 changes: 0 additions & 31 deletions packages/load/src/documents/index.ts

This file was deleted.

4 changes: 0 additions & 4 deletions packages/load/src/documents/loader.ts

This file was deleted.

8 changes: 0 additions & 8 deletions packages/load/src/helpers/path.ts

This file was deleted.

15 changes: 0 additions & 15 deletions packages/load/src/helpers/string.ts

This file was deleted.

93 changes: 0 additions & 93 deletions packages/load/src/schema/from-export.ts

This file was deleted.

31 changes: 0 additions & 31 deletions packages/load/src/schema/from-graphql-file.ts

This file was deleted.

44 changes: 0 additions & 44 deletions packages/load/src/schema/from-json-file.ts

This file was deleted.

Loading

0 comments on commit b4d653e

Please sign in to comment.