Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(gatsby): Convert create-schema-customization to typescript #22392

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion packages/gatsby/src/bootstrap/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ const telemetry = require(`gatsby-telemetry`)

const apiRunnerNode = require(`../utils/api-runner-node`)
import { getBrowsersList } from "../utils/browserslist"
import { createSchemaCustomization } from "../utils/create-schema-customization"
const { store, emitter } = require(`../redux`)
const loadPlugins = require(`./load-plugins`)
const loadThemes = require(`./load-themes`)
Expand Down Expand Up @@ -434,7 +435,7 @@ module.exports = async (args: BootstrapArgs) => {
parentSpan: bootstrapSpan,
})
activity.start()
await require(`../utils/create-schema-customization`)({
await createSchemaCustomization({
parentSpan: bootstrapSpan,
})
activity.end()
Expand Down
2 changes: 1 addition & 1 deletion packages/gatsby/src/commands/develop.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ import bootstrapPageHotReloader from "../bootstrap/page-hot-reloader"
import { developStatic } from "./develop-static"
import withResolverContext from "../schema/context"
import sourceNodes from "../utils/source-nodes"
import createSchemaCustomization from "../utils/create-schema-customization"
import { createSchemaCustomization } from "../utils/create-schema-customization"
import websocketManager from "../utils/websocket-manager"
import getSslCert from "../utils/get-ssl-cert"
import { slash } from "gatsby-core-utils"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,14 @@
const apiRunnerNode = require(`./api-runner-node`)
const { store } = require(`../redux`)
import apiRunnerNode from "./api-runner-node"
import { store } from "../redux"
import { Span } from "opentracing"

module.exports = async ({ refresh = false, parentSpan }) => {
export const createSchemaCustomization = async ({
refresh = false,
parentSpan,
}: {
refresh?: boolean
parentSpan?: Span
}): Promise<void> => {
if (refresh) {
store.dispatch({ type: `CLEAR_SCHEMA_CUSTOMIZATION` })
}
Expand Down