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

Add detector for Expo #672

Merged
merged 2 commits into from
Jan 9, 2020
Merged

Conversation

ianmartorell
Copy link
Contributor

@ianmartorell ianmartorell commented Jan 7, 2020

- Summary
This PR adds a detector for netlify-cli to work automagically with Expo projects.

Prior to this, every project needed to be configured using netlify.toml before netlify dev could be used.

This also fixes #333 since netlify publish now uses the detector config to find the publish directory.

- Test plan
I created a new blank Expo project, ran the dev command on that folder and it started up successfully. Then I ran the publish command and it didn't ask for the build directory.

Note: I also needed to use #669 or the port allocation of the functions server becomes random and netlify dev can't connect.

- Description for the changelog
Add detector for Expo

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

@ianmartorell ianmartorell changed the title Add detector for Expo Add detector for Expo - fixes #333 Jan 7, 2020
@ianmartorell ianmartorell changed the title Add detector for Expo - fixes #333 Add detector for Expo Jan 7, 2020
@ianmartorell ianmartorell force-pushed the expo-detector branch 3 times, most recently from 8cdbada to 2e55901 Compare January 7, 2020 11:36
@ianmartorell
Copy link
Contributor Author

ianmartorell commented Jan 7, 2020

Ideally, there should be a way to inform the user of the URL the proxied server is listening on, because currently the Expo cli clears the terminal and the URL output by netlify-dev disappears. But other than that the detector works great.

@RaeesBhatti
Copy link
Contributor

I tried this locally but the proxyPort is 19006 for some reason but the expo server is running on 19002. I'm not familiar with Expo, can you please explain the different ports and which one is correct.

@ianmartorell
Copy link
Contributor Author

Sure thing! Expo actually starts up a bunch of things on different ports:

  • Expo Development Server runs on port 19000 - it's basically the native app's entrypoint
  • The React Native packager runs on port 19001 - serves JS and assets
  • Expo DevTools runs on port 19002 - I guess this is what you saw?
  • The Webpack dev server runs on port 19006 - this is the one we care about

We want to proxy the Webpack server so that's port 19006. How did you go about trying it locally to see the port 19002?


Something I just realized though, is that when you start an Expo project with expo start:web it will only fire up the DevTools and the Webpack server. As opposed to starting it with expo start --web which will fire up Expo Dev server and the Packager (only needed if you want to run the app on Android or iOS) and then start the Webpack server and open the project in the browser.

So the reason I'm inclined to use expo start:web is that expo start --web automatically opens the Webpack dev server in the browser, which we don't want, and there's no way to configure that on the Expo side as far as I know. However, it seems using expo start:web locks you into not being able to start the React Native side of things.

So I guess the best course of action is to just use Expo defaults and add a way to disable opening the browser automatically in expo-cli.

@RaeesBhatti RaeesBhatti merged commit 913bc6e into netlify:master Jan 9, 2020
@RaeesBhatti
Copy link
Contributor

Thanks for the PR @ianmartorell.

@ianmartorell ianmartorell deleted the expo-detector branch January 12, 2020 00:06
@swyxio
Copy link
Contributor

swyxio commented Jan 13, 2020

this is great! thanks ian!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support for Expo (React Native for web) apps
3 participants