Skip to content

Commit 36eae6b

Browse files
stefanprobstsidharthachatterjee
authored andcommitted
fix(gatsby-source-filesystem): Move GraphQL definition for Fil… (#16041)
1 parent 5fefb17 commit 36eae6b

File tree

2 files changed

+12
-14
lines changed

2 files changed

+12
-14
lines changed

packages/gatsby-source-filesystem/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
],
3737
"license": "MIT",
3838
"peerDependencies": {
39-
"gatsby": "^2.0.0"
39+
"gatsby": "^2.2.0"
4040
},
4141
"repository": {
4242
"type": "git",

packages/gatsby-source-filesystem/src/gatsby-node.js

+11-13
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,19 @@ const createFSMachine = () =>
4040
})
4141

4242
exports.sourceNodes = (
43-
{ actions, getNode, createNodeId, hasNodeChanged, reporter, emitter },
43+
{ actions, getNode, createNodeId, reporter, emitter },
4444
pluginOptions
4545
) => {
46-
const { createNode, deleteNode } = actions
46+
reporter.info(`Creating GraphQL type definition for File`)
47+
const { createNode, createTypes, deleteNode } = actions
48+
49+
const typeDefs = `
50+
type File implements Node @infer {
51+
birthtime: Date @deprecated(reason: "Use \`birthTime\` instead")
52+
birthtimeMs: Float @deprecated(reason: "Use \`birthTime\` instead")
53+
}
54+
`
55+
createTypes(typeDefs)
4756

4857
// Validate that the path exists.
4958
if (!fs.existsSync(pluginOptions.path)) {
@@ -183,14 +192,3 @@ See docs here - https://www.gatsbyjs.org/packages/gatsby-source-filesystem/
183192
}
184193

185194
exports.setFieldsOnGraphQLNodeType = require(`./extend-file-node`)
186-
187-
exports.createSchemaCustomization = ({ actions }) => {
188-
const { createTypes } = actions
189-
const typeDefs = `
190-
type File implements Node @infer {
191-
birthtime: Date @deprecated(reason: "Use \`birthTime\` instead")
192-
birthtimeMs: Float @deprecated(reason: "Use \`birthTime\` instead")
193-
}
194-
`
195-
createTypes(typeDefs)
196-
}

0 commit comments

Comments
 (0)