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

feat: skip work when gatsby version supports adapters #639

Merged
merged 10 commits into from
Jul 19, 2023

Conversation

pieh
Copy link
Contributor

@pieh pieh commented Jun 30, 2023

Summary

This makes this build plugin no-op if Gatsby version supports adapters as all the handling will be done by adapter. Work on gatsby adapters can be tracked in gatsbyjs/gatsby#38232

Test plan

Deploy preview generated by #655 (this is just a draft with changes from this PR + adjusting demo-v5 to use gatsby canary with adapters):

And deploy previews on this PR where build plugin continue to do the work:
https://app.netlify.com/sites/netlify-plugin-gatsby-demo-v5/deploys/64ac064285ef5f0008a0bb7c / https://deploy-preview-639--netlify-plugin-gatsby-demo-v5.netlify.app/

Relevant links (GitHub issues, Notion docs, etc.) or a picture of cute animal

Standard checks:

  • Check the Deploy Preview's Demo site for your PR's functionality
  • Add docs when necessary

Adresses https://github.com/netlify/pod-ecosystem-frameworks/issues/543


🧪 Once merged, make sure to update the version if needed and that it was
published correctly.

@netlify
Copy link

netlify bot commented Jun 30, 2023

Deploy Preview for netlify-plugin-gatsby-demo-v5 ready!

Name Link
🔨 Latest commit bcd2e5d
🔍 Latest deploy log https://app.netlify.com/sites/netlify-plugin-gatsby-demo-v5/deploys/64b7ce0ae75dfb000877ed42
😎 Deploy Preview https://deploy-preview-639--netlify-plugin-gatsby-demo-v5.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@netlify
Copy link

netlify bot commented Jun 30, 2023

Deploy Preview for netlify-plugin-gatsby-demo ready!

Name Link
🔨 Latest commit bcd2e5d
🔍 Latest deploy log https://app.netlify.com/sites/netlify-plugin-gatsby-demo/deploys/64b7ce0a8a01410008fbc88f
😎 Deploy Preview https://deploy-preview-639--netlify-plugin-gatsby-demo.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@pieh pieh marked this pull request as ready for review July 11, 2023 10:16
@pieh pieh requested a review from a team as a code owner July 11, 2023 10:16
Copy link
Contributor

@MarcL MarcL left a comment

Choose a reason for hiding this comment

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

Should we add tests for the skipping code? There's nothing that tests the logic for the adapter existing and us skipping the build process.

@pieh
Copy link
Contributor Author

pieh commented Jul 14, 2023

Should we add tests for the skipping code? There's nothing that tests the logic for the adapter existing and us skipping the build process.

e2e and unit test cases were added

exports.runTests = function runTests(env, host) {
jest.setTimeout(10_000)

async function fetchTwice(url, options) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this to ensure we hit the origin server?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I didn't author the test suite so I'm not sure why it was done like that - it was copied from already existing suite in https://github.com/netlify/netlify-plugin-gatsby/tree/main/plugin/test/fixtures/v5/functions-without-gatsby-plugin/e2e-tests

Those test suites don't actually deploy, they are running ntl dev, and I just changed it to use netlify serve +
skipped some tests here

// `netlify serve` doesn't handle encoded paths same as the platform,
// so skipping these tests
// `${host}/api/some whitespace`,
// `${host}/api/with-äöü-umlaut`,
// `${host}/api/some-àè-french`,
// encodeURI(`${host}/api/some-אודות`),
due to how actual platform differs from netlify serve

just to show they are working when deployed:
/api/some whitespace
/api/with-äöü-umlaut
/api/some-àè-french
/api/some-אודות

Copy link
Contributor

@MarcL MarcL left a comment

Choose a reason for hiding this comment

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

👍🏻

@pieh pieh added the automerge label Jul 19, 2023
@kodiakhq kodiakhq bot merged commit 1e9ba48 into main Jul 19, 2023
@kodiakhq kodiakhq bot deleted the feat/skip-when-adapters-are-available branch July 19, 2023 12:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants