Skip to content

Commit

Permalink
change name
Browse files Browse the repository at this point in the history
  • Loading branch information
LekoArts committed Aug 18, 2022
1 parent 8269c15 commit c4da7fb
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion docs/docs/reference/config-files/gatsby-config.md
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ module.exports = {

You can specifiy the path of the generated TypeScript types file relative to the site root. Default: `src/gatsby-types.d.ts`.

### gatsbyBuild
### generateOnBuild

By default, `graphqlTypegen` is only run during `gatsby develop`. Set this option to `true` to create the `src/gatsby-types.d.ts` file also during `gatsby build`. Default: `false`.

Expand Down
2 changes: 1 addition & 1 deletion packages/gatsby/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ export const graphql: (query: TemplateStringsArray) => StaticQueryDocument

export interface GraphQLTypegenOptions {
typesOutputPath?: string
gatsbyBuild?: boolean
generateOnBuild?: boolean
}

/**
Expand Down
2 changes: 1 addition & 1 deletion packages/gatsby/src/commands/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -427,7 +427,7 @@ module.exports = async function build(
const graphqlTypegenOptions = config.graphqlTypegen

// Only generate types when the option is enabled
if (graphqlTypegenOptions && graphqlTypegenOptions.gatsbyBuild) {
if (graphqlTypegenOptions && graphqlTypegenOptions.generateOnBuild) {
const typegenActivity = reporter.activityTimer(
`Generating TypeScript types`,
{
Expand Down
10 changes: 5 additions & 5 deletions packages/gatsby/src/joi-schemas/__tests__/joi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ describe(`gatsby config`, () => {
expect.objectContaining({
graphqlTypegen: {
typesOutputPath: `src/gatsby-types.d.ts`,
gatsbyBuild: false,
generateOnBuild: false,
},
})
)
Expand All @@ -202,7 +202,7 @@ describe(`gatsby config`, () => {
expect.objectContaining({
graphqlTypegen: {
typesOutputPath: `src/gatsby-types.d.ts`,
gatsbyBuild: false,
generateOnBuild: false,
},
})
)
Expand All @@ -220,7 +220,7 @@ describe(`gatsby config`, () => {
expect.objectContaining({
graphqlTypegen: {
typesOutputPath: `gatsby-types.d.ts`,
gatsbyBuild: false,
generateOnBuild: false,
},
})
)
Expand All @@ -229,7 +229,7 @@ describe(`gatsby config`, () => {
it(`returns partial defaults for graphqlTypegen when partial options object is set`, () => {
const config = {
graphqlTypegen: {
gatsbyBuild: true,
generateOnBuild: true,
},
}

Expand All @@ -238,7 +238,7 @@ describe(`gatsby config`, () => {
expect.objectContaining({
graphqlTypegen: {
typesOutputPath: `src/gatsby-types.d.ts`,
gatsbyBuild: true,
generateOnBuild: true,
},
})
)
Expand Down
4 changes: 2 additions & 2 deletions packages/gatsby/src/joi-schemas/joi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ export const gatsbyConfigSchema: Joi.ObjectSchema<IGatsbyConfig> = Joi.object()
Joi.object()
.keys({
typesOutputPath: Joi.string().default(DEFAULT_TYPES_OUTPUT_PATH),
gatsbyBuild: Joi.boolean().default(false),
generateOnBuild: Joi.boolean().default(false),
})
.unknown(false)
)
Expand All @@ -70,7 +70,7 @@ export const gatsbyConfigSchema: Joi.ObjectSchema<IGatsbyConfig> = Joi.object()
if (value === true) {
return {
typesOutputPath: DEFAULT_TYPES_OUTPUT_PATH,
gatsbyBuild: false,
generateOnBuild: false,
}
}

Expand Down
2 changes: 1 addition & 1 deletion packages/gatsby/src/redux/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ export interface IGatsbyFunction {

export interface IGraphQLTypegenOptions {
typesOutputPath: string
gatsbyBuild: boolean
generateOnBuild: boolean
}

export interface IGatsbyConfig {
Expand Down

0 comments on commit c4da7fb

Please sign in to comment.