Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(gatsby-plugin-netlify): add pluginOptionsSchema export #27420

Merged
merged 8 commits into from
Oct 13, 2020
Merged

chore(gatsby-plugin-netlify): add pluginOptionsSchema export #27420

merged 8 commits into from
Oct 13, 2020

Conversation

mfrachet
Copy link
Contributor

Description

Add plugin options schema to gatsby-plugin-netlify.

Here are the potential options to pass to the plugin:

plugins: [
  {
    resolve: `gatsby-plugin-netlify`,
    options: {
      headers: {}, // option to add more headers. `Link` headers are transformed by the below criteria
      allPageHeaders: [], // option to add headers for all pages. `Link` headers are transformed by the below criteria
      mergeSecurityHeaders: true, // boolean to turn off the default security headers
      mergeLinkHeaders: true, // boolean to turn off the default gatsby js headers
      mergeCachingHeaders: true, // boolean to turn off the default caching headers
      transformHeaders: (headers, path) => headers, // optional transform for manipulating headers under each path (e.g.sorting), etc.
      generateMatchPathRewrites: true, // boolean to turn off automatic creation of redirect rules for client only paths
    },
  },
]

Notes:

  • headers is a specific netlify type corresponding to { [key: string]: Array<string> } (See details)
  • transformHeaders is a function, but I didn't find a way to tell Joi about the return type of that function. In that scenario, the return type should be of type Netlify Headers (see previous bullet)

@gatsbot gatsbot bot added the status: triage needed Issue or pull request that need to be triaged and assigned to a reviewer label Oct 13, 2020
@mfrachet mfrachet removed the status: triage needed Issue or pull request that need to be triaged and assigned to a reviewer label Oct 13, 2020
@mfrachet mfrachet marked this pull request as ready for review October 13, 2020 08:23
Copy link
Contributor

@mxstbr mxstbr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall looks fantastic but I'd love to see descriptions added!

packages/gatsby-plugin-netlify/src/gatsby-node.js Outdated Show resolved Hide resolved
@mfrachet mfrachet requested a review from mxstbr October 13, 2020 08:48
mxstbr
mxstbr previously approved these changes Oct 13, 2020
Copy link
Contributor

@mxstbr mxstbr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fantastic! 💯

packages/gatsby-plugin-netlify/src/gatsby-node.js Outdated Show resolved Hide resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants