-
Notifications
You must be signed in to change notification settings - Fork 10.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(gatsby-source-wordpress): allow path to js file for beforeChange…
…Node option (#32901) * Allow path to js file for beforeChangeNode option * ensure Joi doesn't fail the build for inline beforeChangeNode fn's * Create gatsby-version.ts * Panic on Gatsby v4+ if beforeChangeNode is a function.
- Loading branch information
1 parent
1a87a8a
commit ac7bd4e
Showing
11 changed files
with
136 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
exports.createSchemaCustomization = ({ actions }) => { | ||
const { createTypes } = actions | ||
const typeDefs = ` | ||
type WpPage { | ||
beforeChangeNodeTest: String | ||
} | ||
type WpPost { | ||
beforeChangeNodeTest: String | ||
} | ||
` | ||
createTypes(typeDefs) | ||
} |
5 changes: 5 additions & 0 deletions
5
integration-tests/gatsby-source-wordpress/src/before-change-page.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
module.exports = ({ remoteNode }) => { | ||
remoteNode.beforeChangeNodeTest = `TEST-${remoteNode.id}` | ||
|
||
return remoteNode | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import semver from "semver" | ||
const gatsbyVersion = require(`gatsby/package.json`)?.version | ||
|
||
// gt = greater than | ||
export const usingGatsbyV4OrGreater = semver.gt(gatsbyVersion, `4.0.0`) |