expo / create-react-native-app

Create React Native apps that run on iOS, Android, and web
BSD 3-Clause "New" or "Revised" License
13.27k stars 1.35k forks source link

Warm packager cache on startup #9

Closed anp closed 7 years ago

anp commented 7 years ago

If it's a fresh project, warm both.

Figure out a way to save which platform was last requested. On subsequent starts, only warm the cache with the last requested platform.

brentvatne commented 7 years ago

:+1:

usama54321 commented 7 years ago

Hi,

I was just going through the react native scripts and xdl libraries. Here is what I can understand so far. Please do tell me if I am missing something, as the documentation is a bit sparse and I might have missed something:

To get some kind of information about the last request, we will need to either hook into the xdl library, and pass in some kind of middleware to the express server being created here But this functionality is not present in xdl right now.

The other option will be to hook into the xdl Logs, and look for the last request, which I don't think is the most ideal of solutions.

The easiler solution however would be to just warm both caches at startup.

anp commented 7 years ago

I suspect that the easiest way to do this is going to be to build something in xdl which makes use of the ProjectSettings API: https://github.com/exponent/xdl/blob/master/src/ProjectSettings.js. This information is stored in the project's .expo directory, so we can store information there about what platforms have been loading.

cc @jesseruder

usama54321 commented 7 years ago

Can you please clarify something, I'm sorry. Are we looking to warm the respective platform's cache when a user say runs npm run android/ios, or do we decide the platfrom based on the actual platform from which the app is accessed, i.e. an iphone or an android?

anp commented 7 years ago

I think the ideal situation would be a combination:

jesseruder commented 7 years ago

Recording the last platform loaded in ProjectSettings sounds reasonable.

brentvatne commented 7 years ago

I think now that we have progress indicators this isn't a big deal. In the future we will also show the progress in the app as well. Closing this for now.