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

Dev: Add "framework" option #826

Merged
merged 35 commits into from
Apr 17, 2020
Merged

Dev: Add "framework" option #826

merged 35 commits into from
Apr 17, 2020

Conversation

RaeesBhatti
Copy link
Contributor

@RaeesBhatti RaeesBhatti commented Apr 13, 2020

- Summary
Add framework option for netlify.toml dev section. This allows users to specify #auto to test all detectors, #static to run static file server or one of project types which Netlify Dev can detect to run that detector only.
This will help with situations where users have multiple detectors testing positive and they always have to choose.

Fixes: #469
Fixes: #706
Fixes: #841

- Test plan

- Description for the changelog

  • Add framework option for netlify.toml
  • Add docs for framework option
  • Change type to framework in detectors
  • Rename startProxy param serverType to framework
  • Create loadDetector function
  • Replace chooseDefaultSettings function with chooseDefaultArgs
  • Add default env: { ...process.env } to settings
  • Rename detector file cra to create-react-app
  • Dont slice run from command arguments if command is npm

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

@RaeesBhatti RaeesBhatti marked this pull request as ready for review April 15, 2020 16:47
@RaeesBhatti
Copy link
Contributor Author

Can we get a review on this soon please.
https://community.netlify.com/t/env-node-no-such-file-or-directory-when-using-netlify-cli/12391

@RaeesBhatti RaeesBhatti marked this pull request as draft April 17, 2020 12:54
@RaeesBhatti RaeesBhatti marked this pull request as ready for review April 17, 2020 13:20
@@ -577,7 +528,7 @@ DevCommand.flags = {
live: flags.boolean({
char: 'l',
description: 'Start a public live session'
})
}),
Copy link
Contributor

Choose a reason for hiding this comment

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

Shouldn't Prettier pick up those?

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 don't have prettier setup for oncommit hook, it messes up the staged hunks

for (const i in detectors) {
const detectorResult = detectors[i]()
if (detectorResult) settingsArr.push(detectorResult)
for (const i in detectors) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Can also do:

for (const detector of detectors) {
  const detectorResult = detector()

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Is it compatible with Node 8?

@ehmicky
Copy link
Contributor

ehmicky commented Apr 17, 2020

Looking good except some small details!
Also, it would be good to fix CI tests because they seem to randomly fail currently (not related to this PR).

@RaeesBhatti RaeesBhatti merged commit 7690f04 into master Apr 17, 2020
@RaeesBhatti RaeesBhatti deleted the raees/framework-option branch April 17, 2020 19:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants