This commit is contained in:
parent
99600157c4
commit
980920a72a
|
|
@ -74,8 +74,8 @@ export const schema = makeSchema({
|
|||
types: [], // 1
|
||||
outputs: {
|
||||
typegen: join(__dirname, '..', 'nexus-typegen.ts'), // 2
|
||||
schema: join(__dirname, '..', 'schema.graphql') // 3
|
||||
}
|
||||
schema: join(__dirname, '..', 'schema.graphql'), // 3
|
||||
},
|
||||
})
|
||||
```
|
||||
|
||||
|
|
@ -83,7 +83,7 @@ export const schema = makeSchema({
|
|||
1. Output path to where `@nexus/schema` should write the generated TypeScript definition types derived from your schema. This is **mandatory** to benefit from Nexus' type-safety. We call this system "reflection". More on it later.
|
||||
1. Output path to where `@nexus/schema` should write the SDL version of your GraphQL schema. More on it later as well.
|
||||
|
||||
Finally, we'll setup the GraphQL server. We'll intentionally separate the server instantiation from the server listening to make testing easier later.
|
||||
Finally, we'll setup the GraphQL server. We'll intentionally separate the server instantiation from the server listening to make testing easier later.
|
||||
|
||||
Create an `api/server.ts` file and add the following code to instantiate your GraphQL server
|
||||
|
||||
|
|
@ -122,7 +122,7 @@ You should also see a message indicating that your server is running, and where
|
|||
|
||||
## Try it out
|
||||
|
||||
Open it up, what do you see? It should be an instance of [GraphQL Playground](https://github.com/prisma-labs/graphql-playground).
|
||||
Open it up, what do you see? It should be an instance of [GraphQL Playground](https://github.com/graphql/graphql-playground).
|
||||
|
||||

|
||||
|
||||
|
|
|
|||
|
|
@ -44,6 +44,6 @@ A **field type** is the valid return value used to a field on an object type. In
|
|||
|
||||
### Configuring our types
|
||||
|
||||
The [Ghost Example](https://github.com/prisma-labs/nexus/blob/develop/examples/ghost/src/ghost-schema.ts) is the best to look at for an example of how we're able to capture the types from existing runtime objects or definitions and merge them with our schema.
|
||||
The [Ghost Example](https://github.com/graphql-nexus/schema/blob/develop/examples/ghost/src/ghost-schema.ts) is the best to look at for an example of how we're able to capture the types from existing runtime objects or definitions and merge them with our schema.
|
||||
|
||||
The [makeSchema](/api/make-schema) takes several options which helps us find the types we need to import into our generated schema, and customize where these generated types are output. Read more about the API [here](/api/make-schema).
|
||||
|
|
|
|||
|
|
@ -76,7 +76,7 @@ makeSchema({
|
|||
{
|
||||
source: '@packages/types/src/db.ts',
|
||||
alias: 'dbt',
|
||||
typeMatch: name => new RegExp(`(?:interface|type|class)\\s+(${name}s?)\\W`, 'g'),
|
||||
typeMatch: (name) => new RegExp(`(?:interface|type|class)\\s+(${name}s?)\\W`, 'g'),
|
||||
},
|
||||
// We also need to import this source in order to provide it as the `contextType` below.
|
||||
{
|
||||
|
|
@ -96,7 +96,7 @@ makeSchema({
|
|||
})
|
||||
```
|
||||
|
||||
The [Ghost Example](https://github.com/prisma-labs/nexus/blob/develop/examples/ghost/src/ghost-schema.ts) is the best place to look for an example of how we're able to capture the types from existing runtime objects or definitions and merge them with our schema.
|
||||
The [Ghost Example](https://github.com/graphql-nexus/schema/blob/develop/examples/ghost/src/ghost-schema.ts) is the best place to look for an example of how we're able to capture the types from existing runtime objects or definitions and merge them with our schema.
|
||||
|
||||
## shouldExitAfterGenerateArtifacts
|
||||
|
||||
|
|
@ -144,7 +144,7 @@ Optional, allows you to override the `printSchema` when outputting the generated
|
|||
```ts
|
||||
makeSchema({
|
||||
// ...
|
||||
customPrintSchemaFn: schema => {
|
||||
customPrintSchemaFn: (schema) => {
|
||||
return printSchema(schema, { commentDescriptions: true })
|
||||
},
|
||||
})
|
||||
|
|
|
|||
|
|
@ -4,4 +4,4 @@
|
|||
|
||||
Makes use of [schemats](https://github.com/SweetIQ/schemats) to auto-generate types, and uses nexus's configuration to automatically bind these types to our schema generated types.
|
||||
|
||||
To setup, create a mysql database called `ghost_nexus` and configure the values in [config.development.js](https://github.com/prisma-labs/nexus/blob/develop/examples/ghost/config.development.json) as necessary.
|
||||
To setup, create a mysql database called `ghost_nexus` and configure the values in [config.development.js](https://github.com/graphql-nexus/schema/blob/develop/examples/ghost/config.development.json) as necessary.
|
||||
|
|
|
|||
|
|
@ -1589,7 +1589,7 @@ function invariantGuard(val: any) {
|
|||
if (Boolean(val) === false) {
|
||||
throw new Error(
|
||||
'Nexus Error: This should never happen, ' +
|
||||
'please check your code or if you think this is a bug open a GitHub issue https://github.com/prisma-labs/nexus/issues/new.'
|
||||
'please check your code or if you think this is a bug open a GitHub issue https://github.com/graphql-nexus/schema/issues/new.'
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -92,7 +92,7 @@ export class TypegenMetadata {
|
|||
}
|
||||
// VSCode reacts to file changes better if a file is first deleted,
|
||||
// apparently. See issue motivating this logic here:
|
||||
// https://github.com/prisma-labs/nexus/issues/247.
|
||||
// https://github.com/graphql-nexus/schema/issues/247.
|
||||
try {
|
||||
await removeFile(filePath)
|
||||
} catch (e) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue