fix: Update packages and fix local dev (#26907)
<!-- Please follow this checklist and put an x in each of the boxes, like this: [x]. It will ensure that our team takes your pull request seriously. --> - [x] I have read [freeCodeCamp's contribution guidelines](https://github.com/freeCodeCamp/freeCodeCamp/blob/master/CONTRIBUTING.md). - [x] My pull request has a descriptive title (not a vague title like `Update index.md`) - [x] My pull request targets the `master` branch of freeCodeCamp.
This commit is contained in:
committed by
mrugesh mohapatra
parent
153e1c9f38
commit
7da04a348b
@ -1,6 +1,6 @@
|
||||
require('dotenv').config();
|
||||
|
||||
const { createFilePath } = require('@freecodecamp/gatsby-source-filesystem');
|
||||
const { createFilePath } = require('gatsby-source-filesystem');
|
||||
|
||||
const { dasherize } = require('./utils');
|
||||
const { blockNameify } = require('./utils/blockNameify');
|
||||
@ -37,7 +37,7 @@ exports.onCreateNode = function onCreateNode({ node, actions, getNode }) {
|
||||
}
|
||||
};
|
||||
|
||||
exports.createPages = ({ graphql, actions }) => {
|
||||
exports.createPages = function createPages({ graphql, actions }) {
|
||||
const { createPage } = actions;
|
||||
|
||||
return new Promise((resolve, reject) => {
|
||||
@ -73,6 +73,7 @@ exports.createPages = ({ graphql, actions }) => {
|
||||
node {
|
||||
fields {
|
||||
slug
|
||||
nodeIdentity
|
||||
}
|
||||
frontmatter {
|
||||
block
|
||||
@ -82,9 +83,6 @@ exports.createPages = ({ graphql, actions }) => {
|
||||
htmlAst
|
||||
id
|
||||
excerpt
|
||||
internal {
|
||||
identity
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -92,7 +90,7 @@ exports.createPages = ({ graphql, actions }) => {
|
||||
`).then(result => {
|
||||
if (result.errors) {
|
||||
console.log(result.errors);
|
||||
reject(result.errors);
|
||||
return reject(result.errors);
|
||||
}
|
||||
|
||||
// Create challenge pages.
|
||||
@ -103,34 +101,32 @@ exports.createPages = ({ graphql, actions }) => {
|
||||
// Create intro pages
|
||||
result.data.allMarkdownRemark.edges.forEach(edge => {
|
||||
const {
|
||||
node: {
|
||||
internal: { identity },
|
||||
frontmatter,
|
||||
fields
|
||||
}
|
||||
node: { frontmatter, fields }
|
||||
} = edge;
|
||||
|
||||
if (!fields) {
|
||||
return null;
|
||||
}
|
||||
const { slug } = fields;
|
||||
const { slug, nodeIdentity } = fields;
|
||||
if (slug.includes('LICENCE')) {
|
||||
return null;
|
||||
}
|
||||
try {
|
||||
const pageBuilder = createByIdentityMap[identity](createPage);
|
||||
const pageBuilder = createByIdentityMap[nodeIdentity](createPage);
|
||||
return pageBuilder(edge);
|
||||
} catch (e) {
|
||||
console.log(`
|
||||
ident: ${identity} does not belong to a function
|
||||
ident: ${nodeIdentity} does not belong to a function
|
||||
|
||||
${frontmatter ? JSON.stringify(edge.node) : 'no frontmatter'}
|
||||
|
||||
|
||||
`);
|
||||
}
|
||||
return null;
|
||||
});
|
||||
|
||||
return;
|
||||
return null;
|
||||
})
|
||||
);
|
||||
});
|
||||
|
Reference in New Issue
Block a user