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: write granular info into skip file #128

Merged
merged 4 commits into from
May 18, 2022
Merged

feat: write granular info into skip file #128

merged 4 commits into from
May 18, 2022

Conversation

orinokai
Copy link
Contributor

@orinokai orinokai commented May 13, 2022

This PR supports allowing API, SSR and DSG functions to be disabled individually by reporting which functions are needed in the skip file generated by the plugin.

The change maintains backward compatibility by ensuring that no skip file still indicates all functions are needed.

@github-actions github-actions bot added the type: feature code contributing to the implementation of a feature and/or user facing functionality label May 13, 2022
@orinokai orinokai self-assigned this May 13, 2022
@orinokai orinokai marked this pull request as ready for review May 18, 2022 08:39
@orinokai orinokai requested a review from a team May 18, 2022 08:39
Copy link
Member

@ascorbic ascorbic left a comment

Choose a reason for hiding this comment

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

Great stuff. Thanks for the tests

reporter.info(`[gatsby-plugin-netlify] No Netlify functions needed. Skipping...`)
await writeFile(join(program.directory, `.cache`, `.nf-skip-gatsby-functions`), ``)
}
const skipFilePath = join(program.directory, `.cache`, `.nf-skip-gatsby-functions`)
Copy link
Member

Choose a reason for hiding this comment

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

It's a little confusing that the skip file sets the value "true" when it shouldn't be skipped, but that's probably fine for an internal API, and I can see why it's needed for backwards-compat

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yep, I went round in circles with this one for a while! As you mentioned, for backwards-compat I ending up settling on this approach because I didn't want to rename the skip file and it was confusing to negate the values in netlify-plugin-gatsby when checking if a function should be bundled.

@kodiakhq kodiakhq bot merged commit abefe10 into main May 18, 2022
@kodiakhq kodiakhq bot deleted the rs/granular-funcs branch May 18, 2022 09:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
automerge type: feature code contributing to the implementation of a feature and/or user facing functionality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants