We need to define how are we going to start the server. Right now the ./bin/start script searches for the build folder. If it does not find it it'll build the react site with npm run build. It won't re-run build if the folder exists. The problem is that when we eventually update the code, the users will have to force a build. Building on each ./bin/start could be a solution, but it takes too much time so, to me we can:
serve the files with npm start, the default create-react-app server and use the current express server as an API.
Update ./bin/start to be version-aware and find a way to alert the user of updates on the code
Version the build folder on git, try to build if it's not there on ./bin/start
I went with the last option, as it's the one with the least friction for the user, but it's easily changed.
What do you think?
This is a long PR.
Please test and let me know any feedback on the implementation (it's my first time using sagas)
The idea is to have the same features as the old vanilla-based version, so there's still room for improvement (for example, for error handling)
There's a lot of new code and configuration, so it's likely that I missed something, let me know!
To run, you can just use
RPC_API_KEY="KEY" ./bin/start
, or, if you're feeling adventurous:Visit https://github.com/decentraland/bronzeage-node/tree/convert-to-react/browser for more info!
Important
./bin/start
script searches for thebuild
folder. If it does not find it it'll build the react site withnpm run build
. It won't re-runbuild
if the folder exists. The problem is that when we eventually update the code, the users will have to force a build. Building on each./bin/start
could be a solution, but it takes too much time so, to me we can:npm start
, the defaultcreate-react-app
server and use the current express server as an API../bin/start
to be version-aware and find a way to alert the user of updates on the code./bin/start
I went with the last option, as it's the one with the least friction for the user, but it's easily changed. What do you think?
🎩