{"size": 1128, "ext": "js", "max_stars_repo_path": "gatsby-node.js", "max_stars_repo_name": "mBourges/standards", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "gatsby-node.js", "max_issues_repo_name": "mBourges/standards", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "gatsby-node.js", "max_forks_repo_name": "mBourges/standards", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 22.1176470588, "max_line_length": 69, "alphanum_fraction": 0.6019503546}
const DOCUMENTATION_FOLDER = '/documentation/';

function isDocumentationPage(node) {
  const { internal, path } = node;

  return internal.type === 'SitePage'
    && path.startsWith(DOCUMENTATION_FOLDER);
}

function formatDocumentationPageName(path) {
  return path.substring(DOCUMENTATION_FOLDER.length, path.length - 1)
    .replace(/\-/gi, ' ');
}

exports.onCreateNode = ({ node, actions }) => {
  const { createNodeField } = actions

  if (isDocumentationPage(node)) {
    createNodeField({
      node,
      name: 'name',
      value: formatDocumentationPageName(node.path)
    })
  }
}

exports.onCreatePage = async ({ page, actions }) => {
  const { createPage } = actions;

  if (page.path.match(/^\/account/)) {
    page.matchPath = "/account/*";
    createPage(page)
  }
};

exports.onCreateWebpackConfig = ({ stage, loaders, actions }) => {
  if (stage === 'build-html') {
    // Exclude Sign-In Widget from compilation path
    actions.setWebpackConfig({
      module: {
        rules: [
          {
            test: /okta-sign-in/,
            use: loaders.null(),
          }
        ],
      },
    })
  }
};
