Skip to content

Commit

Permalink
feat: support for Gatsby v5 (#679)
Browse files Browse the repository at this point in the history
* feat: support for Gatsby v5

* ci: run checks on pull request, not on target
  • Loading branch information
browniebroke authored Nov 13, 2022
1 parent 9830d8a commit f53feb3
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ on:
push:
branches:
- main
pull_request_target:
pull_request:
branches:
- main
jobs:
Expand All @@ -12,7 +12,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
node: ["14.x"]
node: ["18.x"]
steps:
- name: Setup
uses: actions/setup-node@v3.1.1
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
"semantic-release": "^19.0.2"
},
"peerDependencies": {
"gatsby": "^4.0.0 || ^3.0.0 || ^2.0.0"
"gatsby": "^5.0.0"
},
"jest": {
"collectCoverage": true
Expand Down
2 changes: 1 addition & 1 deletion src/gatsby-node.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ export async function onPostBuild({ graphql, pathPrefix = "" }, pluginOptions) {
!Object.prototype.hasOwnProperty.call(mergedOptions, 'sitemap')
) {

mergedOptions.sitemap = new URL(path.posix.join(pathPrefix, 'sitemap', 'sitemap-index.xml'), mergedOptions.host).toString();
mergedOptions.sitemap = new URL(path.posix.join(pathPrefix, 'sitemap-index.xml'), mergedOptions.host).toString();
} else {
try {
new URL(mergedOptions.sitemap)
Expand Down
2 changes: 1 addition & 1 deletion test/__snapshots__/gatsby-node.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ Host: https://www.test.com
exports[`onPostBuild should generate \`robots.txt\` using \`graphql\` options 1`] = `
"User-agent: *
Allow: /
Sitemap: https://www.test.com/sitemap/sitemap-index.xml
Sitemap: https://www.test.com/sitemap-index.xml
Host: https://www.test.com
"
`;
Expand Down
2 changes: 1 addition & 1 deletion test/gatsby-node.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ describe('onPostBuild', () => {

const data = await fsp.readFile(resolvePath(output))

expect(data.toString()).toContain('Sitemap: https://www.test.com/prefix/sitemap/sitemap-index.xml');
expect(data.toString()).toContain('Sitemap: https://www.test.com/prefix/sitemap-index.xml');
})

it(`should add pathPrefix to provided sitemap`, async () => {
Expand Down

0 comments on commit f53feb3

Please sign in to comment.