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

Improve robustness of netlify-lambda function-builder-detector #1776

Conversation

Robin-Hoodie
Copy link
Contributor

- Summary

This PR fixes a few edge cases where the netlify-lambda build command would be detected, but would not run correctly

- Test plan

You can view the added tests in the commits

- Description for the changelog

Improve detection of invalid netlify-lambda build commands & detect functions folder regardless of options placement

- A picture of a cute animal (not mandatory but encouraged)

My 2 cats when they were kittens:

image

@Robin-Hoodie Robin-Hoodie requested a review from a team as a code owner January 19, 2021 21:23
@erezrokah erezrokah added the type: bug code to address defects in shipped code label Jan 20, 2021
@erezrokah erezrokah self-requested a review January 20, 2021 19:32
Copy link
Contributor

@erezrokah erezrokah left a comment

Choose a reason for hiding this comment

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

Thanks for the fix @Robin-Hoodie. This looks good and sorry for the delay reviewing it

break
if (script.match(/netlify-lambda\s+build/)) {
// E.g. ["netlify-lambda", "build", "functions/folder"]
const match = minimist(script.split(' '))
Copy link
Contributor

@erezrokah erezrokah Jan 21, 2021

Choose a reason for hiding this comment

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

This isn't whitespace safe (e.g. a functions folder with a whitespace will break this), but the current approach isn't either and this works for more use cases.
🚀

@erezrokah erezrokah merged commit b486fe5 into netlify:master Jan 21, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug code to address defects in shipped code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Netlify Function Builder Detector for netlify-lambda can detect wrong functions source folder
2 participants