Comparing version 0.12.0-rc.4 to 0.12.0-rc.5
@@ -5,6 +5,16 @@ # Changelog | ||
### 0.12.0-rc.5 | ||
- feat: Add `customPrintSchemaFn` to makeSchema config | ||
### 0.12.0-rc.4 | ||
- refactor: Remove NEXUS_SHOULD_GENERATE_ARTIFACTS env var | ||
- feat: Add `shouldExitAfterGenerateArtifacts` | ||
- Warn on missing `outputs` in `makeSchema` config | ||
- Type-level `defaultResolver` has been removed, similar functionality can be achieved with the `onCreateFieldResolver` plugin API | ||
### 0.12.0-rc.2, rc.3 | ||
@@ -11,0 +21,0 @@ |
@@ -1,2 +0,2 @@ | ||
import { GraphQLEnumType, GraphQLFieldConfig, GraphQLFieldConfigArgumentMap, GraphQLFieldConfigMap, GraphQLFieldResolver, GraphQLInputFieldConfig, GraphQLInputFieldConfigMap, GraphQLInputObjectType, GraphQLInputType, GraphQLInterfaceType, GraphQLNamedType, GraphQLObjectType, GraphQLOutputType, GraphQLScalarType, GraphQLSchema, GraphQLUnionType, GraphQLField, GraphQLType } from "graphql"; | ||
import { GraphQLEnumType, GraphQLFieldConfig, GraphQLFieldConfigArgumentMap, GraphQLFieldConfigMap, GraphQLFieldResolver, GraphQLInputFieldConfig, GraphQLInputFieldConfigMap, GraphQLInputObjectType, GraphQLInputType, GraphQLInterfaceType, GraphQLNamedType, GraphQLObjectType, GraphQLOutputType, GraphQLScalarType, GraphQLSchema, GraphQLUnionType, GraphQLField, GraphQLType, printSchema } from "graphql"; | ||
import { NexusArgConfig, ArgsRecord } from "./definitions/args"; | ||
@@ -99,2 +99,7 @@ import { InputDefinitionBlock, NexusInputFieldDef, NexusOutputFieldDef, OutputDefinitionBlock } from "./definitions/definitionBlocks"; | ||
plugins?: NexusPlugin[]; | ||
/** | ||
* Provide if you wish to customize the behavior of the schema printing. | ||
* Otherwise, uses `printSchema` from graphql-js | ||
*/ | ||
customPrintSchemaFn?: typeof printSchema; | ||
} | ||
@@ -248,5 +253,5 @@ export declare type SchemaConfig = BuilderConfig & { | ||
constructor(config: BuilderConfig); | ||
setConfigOption: <K extends "nonNullDefaults" | "outputs" | "shouldGenerateArtifacts" | "typegenAutoConfig" | "typegenConfig" | "prettierConfig" | "formatTypegen" | "plugins">(key: K, value: BuilderConfig[K]) => void; | ||
hasConfigOption: (key: "nonNullDefaults" | "outputs" | "shouldGenerateArtifacts" | "typegenAutoConfig" | "typegenConfig" | "prettierConfig" | "formatTypegen" | "plugins") => boolean; | ||
getConfigOption: <K extends "nonNullDefaults" | "outputs" | "shouldGenerateArtifacts" | "typegenAutoConfig" | "typegenConfig" | "prettierConfig" | "formatTypegen" | "plugins">(key: K) => BuilderConfig[K]; | ||
setConfigOption: <K extends "nonNullDefaults" | "outputs" | "shouldGenerateArtifacts" | "typegenAutoConfig" | "typegenConfig" | "prettierConfig" | "formatTypegen" | "plugins" | "customPrintSchemaFn">(key: K, value: BuilderConfig[K]) => void; | ||
hasConfigOption: (key: "nonNullDefaults" | "outputs" | "shouldGenerateArtifacts" | "typegenAutoConfig" | "typegenConfig" | "prettierConfig" | "formatTypegen" | "plugins" | "customPrintSchemaFn") => boolean; | ||
getConfigOption: <K extends "nonNullDefaults" | "outputs" | "shouldGenerateArtifacts" | "typegenAutoConfig" | "typegenConfig" | "prettierConfig" | "formatTypegen" | "plugins" | "customPrintSchemaFn">(key: K) => BuilderConfig[K]; | ||
hasType: (typeName: string) => boolean; | ||
@@ -253,0 +258,0 @@ /** |
@@ -49,6 +49,2 @@ import { OutputDefinitionBlock, OutputDefinitionBuilder } from "./definitionBlocks"; | ||
/** | ||
* Specifies a default field resolver for all members of this type. | ||
*/ | ||
defaultResolver?: FieldResolver<TypeName, any>; | ||
/** | ||
* Root type information for this type | ||
@@ -55,0 +51,0 @@ */ |
@@ -23,3 +23,3 @@ import { NexusOutputFieldConfig } from "./definitions/definitionBlocks"; | ||
* Whether the user has provided a custom "resolve" function, | ||
* or whether we're using the defaultResolver | ||
* or whether we're using GraphQL's defaultResolver | ||
*/ | ||
@@ -26,0 +26,0 @@ readonly hasDefinedResolver: boolean; |
@@ -110,3 +110,5 @@ "use strict"; | ||
generateSchemaFile(schema) { | ||
let printedSchema = graphql_1.printSchema(schema); | ||
let printedSchema = this.config.customPrintSchemaFn | ||
? this.config.customPrintSchemaFn(schema) | ||
: graphql_1.printSchema(schema); | ||
return [lang_1.SDL_HEADER, printedSchema].join("\n\n"); | ||
@@ -113,0 +115,0 @@ } |
{ | ||
"name": "nexus", | ||
"version": "0.12.0-rc.4", | ||
"version": "0.12.0-rc.5", | ||
"description": "Scalable, strongly typed GraphQL schema development", | ||
@@ -82,3 +82,3 @@ "keywords": [ | ||
"lint-staged": "^7.3.0", | ||
"prettier": "prettier/prettier#refs/pull/6736/head", | ||
"prettier": "^1.19.1", | ||
"sort-package-json": "^1.22.1", | ||
@@ -89,3 +89,3 @@ "ts-jest": "^24.1.0", | ||
"tslint-config-prettier": "^1.15.0", | ||
"typescript": "3.7.1-rc" | ||
"typescript": "^3.7.2" | ||
}, | ||
@@ -92,0 +92,0 @@ "peerDependencies": { |
@@ -41,2 +41,3 @@ import { | ||
isUnionType, | ||
printSchema, | ||
} from "graphql"; | ||
@@ -247,2 +248,7 @@ import { | ||
plugins?: NexusPlugin[]; | ||
/** | ||
* Provide if you wish to customize the behavior of the schema printing. | ||
* Otherwise, uses `printSchema` from graphql-js | ||
*/ | ||
customPrintSchemaFn?: typeof printSchema; | ||
} | ||
@@ -249,0 +255,0 @@ |
@@ -82,6 +82,2 @@ import { | ||
/** | ||
* Specifies a default field resolver for all members of this type. | ||
*/ | ||
defaultResolver?: FieldResolver<TypeName, any>; | ||
/** | ||
* Root type information for this type | ||
@@ -88,0 +84,0 @@ */ |
@@ -31,3 +31,3 @@ import { NexusOutputFieldConfig } from "./definitions/definitionBlocks"; | ||
* Whether the user has provided a custom "resolve" function, | ||
* or whether we're using the defaultResolver | ||
* or whether we're using GraphQL's defaultResolver | ||
*/ | ||
@@ -34,0 +34,0 @@ readonly hasDefinedResolver: boolean; |
@@ -126,3 +126,5 @@ import { GraphQLSchema, lexicographicSortSchema, printSchema } from "graphql"; | ||
generateSchemaFile(schema: GraphQLSchema): string { | ||
let printedSchema = printSchema(schema); | ||
let printedSchema = this.config.customPrintSchemaFn | ||
? this.config.customPrintSchemaFn(schema) | ||
: printSchema(schema); | ||
return [SDL_HEADER, printedSchema].join("\n\n"); | ||
@@ -129,0 +131,0 @@ } |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
12482
776366