Skip to content

Commit

Permalink
Merge pull request layer5io#6156 from layer5io/leecalcote/gatsby-upgrade
Browse files Browse the repository at this point in the history
[chore] upgrade gatsby
  • Loading branch information
jameshorton2337 authored Jan 5, 2025
2 parents 9d249e7 + 1aaf9e1 commit a6d1537
Show file tree
Hide file tree
Showing 5 changed files with 432 additions and 729 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/build-and-preview-site.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ jobs:
- name: Install and Build 🔧
run: |
npm install --legacy-peer-deps
node -v
npm run version
npm run noIndex
- name: Zip Site
Expand Down
39 changes: 38 additions & 1 deletion gatsby-node.js
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,12 @@ exports.createPages = async ({ actions, graphql, reporter }) => {
redirectInBrowser: true,
isPermanent: true,
});

createRedirect({
fromPath: "/sitemap.xml",
toPath: "/sitemap-index.xml",
redirectInBrowser: true,
isPermanent: true,
});
// Create Pages
const { createPage } = actions;

Expand Down Expand Up @@ -1038,3 +1043,35 @@ exports.createSchemaCustomization = ({ actions }) => {
`;
createTypes(typeDefs);
};

const fs = require("fs");

exports.onPostBuild = async ({ graphql, reporter }) => {
const result = await graphql(`
{
allSitePage {
nodes {
path
matchPath
}
}
site {
siteMetadata {
siteUrl
}
}
}
`);

if (result.errors) {
reporter.panicOnBuild("Error while running GraphQL query.");
return;
}

// Log the result to the console
console.log("GraphQL query result:", JSON.stringify(result, null, 2));

// Optionally, write the result to a file for easier inspection
const outputPath = path.resolve(__dirname, "public", "query-result.json");
fs.writeFileSync(outputPath, JSON.stringify(result, null, 2));
};
Loading

0 comments on commit a6d1537

Please sign in to comment.