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

Netlify Dev: Add framework = "#custom" option #843

Merged
merged 34 commits into from
May 4, 2020

Conversation

RaeesBhatti
Copy link
Contributor

@RaeesBhatti RaeesBhatti commented Apr 18, 2020

- Summary
This is to clear confusion around usage.
If framework = "#custom" in netlify.toml dev section, the user must specify command and targetPort options as well and we'll throw an error if they're missing any of these.
If framework is not #custom and user has specified command and targetPort options, we'll throw an error and ask them set framework to #custom.
If dir flag is specified, we'll ignore all detectors and throw an error if targetPort or command is specified.

Fixes: #827
Fixes: #441
Fixes: #851
Fixes: #862
Fixes: #850
Fixes: #847

- Test plan

  • New tests added.
  • Run netlify dev in your project

- Description for the changelog

  • Add framework = "#custom" option for netlify.toml's dev section
  • Don't allow usage of --dir flag with command or targetPort config options
  • Add more test
  • Throw lots of errors for invalid config

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

@erquhart
Copy link
Contributor

It sounds like our heuristics are getting thrown off. Do we know specific reasons why inferred build command and port didn’t work for the linked issues?

It seems ideal to address this by being very clear about what configuration has been inferred. If we do go the disabling route, consider adding an option for disabling heuristics (would need a sensible name not involving the word “heuristics”) rather than accepting a special framework name.

@RaeesBhatti RaeesBhatti marked this pull request as draft April 29, 2020 00:24
@RaeesBhatti RaeesBhatti marked this pull request as ready for review May 2, 2020 16:26
@RaeesBhatti RaeesBhatti added type: bug code to address defects in shipped code and removed type: bug code to address defects in shipped code labels May 4, 2020
@RaeesBhatti
Copy link
Contributor Author

Highlights

  • Fixing the confusion around detectors and command, port, targetPort options
  • When we're running with custom command and targetPort we don't know at the stage of redirect routing if it's a static server or a framework server, passing down value of framework and making sure it's present even when someone is using custom framework enables us to route to correct endpoint
  • Making absolutely sure that the user can't get Netlify Dev config wrong. We're throwing errors with helpful and instructive messages to tell the users when they have a problematic config
  • The static server settings were being overwritten and this was leading to confusion, we're making sure that the critical settings can't be overwritten in a way that causes confusion
  • Mores tests, both unit tests and integration tests with larger overview. We're also testing create-react-app now to make sure that config works perfectly in a dynamic app, not just a static one.

@RaeesBhatti RaeesBhatti merged commit 23b8dae into master May 4, 2020
@RaeesBhatti RaeesBhatti deleted the raees/dev-config-improvements branch May 4, 2020 18:28
@erezrokah erezrokah mentioned this pull request Mar 22, 2021
1 task
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
3 participants