Skip to content

Commit

Permalink
chore(gatsby): Convert create-schema-customization to typescript (#22392
Browse files Browse the repository at this point in the history
)
  • Loading branch information
mottox2 committed Mar 19, 2020
1 parent d2d32d4 commit 9a783f4
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 5 deletions.
3 changes: 2 additions & 1 deletion packages/gatsby/src/bootstrap/index.js
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
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
@@ -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

0 comments on commit 9a783f4

Please sign in to comment.