Skip to content

Commit

Permalink
fix(gatsby-source-filesystem): Move GraphQL definition for Fil… (#16041)
Browse files Browse the repository at this point in the history
  • Loading branch information
stefanprobst authored and sidharthachatterjee committed Jul 30, 2019
1 parent 5fefb17 commit 36eae6b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 14 deletions.
2 changes: 1 addition & 1 deletion packages/gatsby-source-filesystem/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
],
"license": "MIT",
"peerDependencies": {
"gatsby": "^2.0.0"
"gatsby": "^2.2.0"
},
"repository": {
"type": "git",
Expand Down
24 changes: 11 additions & 13 deletions packages/gatsby-source-filesystem/src/gatsby-node.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,19 @@ const createFSMachine = () =>
})

exports.sourceNodes = (
{ actions, getNode, createNodeId, hasNodeChanged, reporter, emitter },
{ actions, getNode, createNodeId, reporter, emitter },
pluginOptions
) => {
const { createNode, deleteNode } = actions
reporter.info(`Creating GraphQL type definition for File`)
const { createNode, createTypes, deleteNode } = actions

const typeDefs = `
type File implements Node @infer {
birthtime: Date @deprecated(reason: "Use \`birthTime\` instead")
birthtimeMs: Float @deprecated(reason: "Use \`birthTime\` instead")
}
`
createTypes(typeDefs)

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

exports.setFieldsOnGraphQLNodeType = require(`./extend-file-node`)

exports.createSchemaCustomization = ({ actions }) => {
const { createTypes } = actions
const typeDefs = `
type File implements Node @infer {
birthtime: Date @deprecated(reason: "Use \`birthTime\` instead")
birthtimeMs: Float @deprecated(reason: "Use \`birthTime\` instead")
}
`
createTypes(typeDefs)
}

0 comments on commit 36eae6b

Please sign in to comment.