Skip to content

Commit 24d4890

Browse files
authored
README and package.json updates (#20)
1 parent 2154044 commit 24d4890

File tree

4 files changed

+41
-38
lines changed

4 files changed

+41
-38
lines changed

README.md

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

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
packages/schema/README.md

packages/extend/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{
22
"name": "@graphql-ts/extend",
33
"version": "1.0.0",
4+
"description": "Utilities to extend existing GraphQL schemas with @graphql-ts/schema",
45
"main": "dist/graphql-ts-extend.cjs.js",
56
"module": "dist/graphql-ts-extend.esm.js",
67
"exports": {

packages/schema/README.md

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# @graphql-ts/schema
2+
3+
`@graphql-ts/schema` is a thin wrapper around
4+
[GraphQL.js](https://github.com/graphql/graphql-js) providing type-safety for
5+
constructing GraphQL Schemas while avoiding type-generation, [declaration merging](https://www.typescriptlang.org/docs/handbook/declaration-merging.html)
6+
and [decorators](https://www.typescriptlang.org/docs/handbook/decorators.html).
7+
8+
```ts
9+
import { graphql } from "@graphql-ts/schema";
10+
import { GraphQLSchema, graphql as runGraphQL } from "graphql";
11+
12+
const Query = graphql.object()({
13+
name: "Query",
14+
fields: {
15+
hello: graphql.field({
16+
type: graphql.String,
17+
resolve() {
18+
return "Hello!";
19+
},
20+
}),
21+
},
22+
});
23+
24+
const schema = new GraphQLSchema({
25+
query: Query.graphQLType,
26+
});
27+
28+
runGraphQL({
29+
source: `
30+
query {
31+
hello
32+
}
33+
`,
34+
schema,
35+
}).then((result) => {
36+
console.log(result);
37+
});
38+
```

packages/schema/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{
22
"name": "@graphql-ts/schema",
33
"version": "0.6.0",
4+
"description": "Type-safety for constructing GraphQL schemas in TypeScript",
45
"main": "dist/graphql-ts-schema.cjs.js",
56
"module": "dist/graphql-ts-schema.esm.js",
67
"exports": {

0 commit comments

Comments
 (0)