Skip to content

feat: log warning if old functions exist #801

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

Merged
merged 2 commits into from
Nov 16, 2021
Merged

feat: log warning if old functions exist #801

merged 2 commits into from
Nov 16, 2021

Conversation

ascorbic
Copy link
Contributor

Summary

The old version of the plugin generated lots of functions which may be still lying around in users' sites, either checked-in to scm or just uncleaned in a build directory. These can cause errors and slow builds. This PR detects any functions called next_* (which was the naming convention) and warns the user that they should delete them.

Test plan

Create a function in the demo project, either in .netlify/internal-functions or netlify/functions, with a name starting with next_. Run a build and note the warning.

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

image

Fixes #772

@ascorbic ascorbic requested a review from a team November 16, 2021 10:19
@ascorbic ascorbic self-assigned this Nov 16, 2021
@github-actions github-actions bot added the type: feature code contributing to the implementation of a feature and/or user facing functionality label Nov 16, 2021
test/index.js Outdated

expect(logMock).toHaveBeenCalledWith(
expect.stringContaining(
'We have found the following functions in your site that seem to be left over from the old Next.js plugin.',

Choose a reason for hiding this comment

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

[sand] The test should probably contain the logged files too

tiffafoo
tiffafoo previously approved these changes Nov 16, 2021
Co-authored-by: Tiffany Le-Nguyen <tiffany@netlify.com>
@kodiakhq kodiakhq bot merged commit 01faf58 into main Nov 16, 2021
@kodiakhq kodiakhq bot deleted the mk/old-func-check branch November 16, 2021 17:57
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.

Warn if functions from old plugin exist
2 participants